Skip to content

Commit dee8906

Browse files
feat(api): added a helper to create the feature each time an organization is created in tests
1 parent cc3bc1a commit dee8906

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

api/tests/test-helper.js

+10
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { PIX_ADMIN } from '../src/authorization/domain/constants.js';
2626
import * as tutorialRepository from '../src/devcomp/infrastructure/repositories/tutorial-repository.js';
2727
import * as missionRepository from '../src/school/infrastructure/repositories/mission-repository.js';
2828
import { config } from '../src/shared/config.js';
29+
import { ORGANIZATION_FEATURE } from '../src/shared/domain/constants.js';
2930
import { Membership } from '../src/shared/domain/models/index.js';
3031
import * as tokenService from '../src/shared/domain/services/token-service.js';
3132
import { featureToggles } from '../src/shared/infrastructure/feature-toggles/index.js';
@@ -192,6 +193,14 @@ async function insertOrganizationUserWithRoleAdmin() {
192193
return { adminUser, organization };
193194
}
194195

196+
// We insert a multiple sending feature by default for each new organization created.
197+
// It is under feature for now because we want to be able to deactivate it when asked.
198+
async function insertMultipleSendingFeatureForNewOrganization() {
199+
const feature = databaseBuilder.factory.buildFeature(ORGANIZATION_FEATURE.MULTIPLE_SENDING_ASSESSMENT);
200+
await databaseBuilder.commit();
201+
return feature.id;
202+
}
203+
195204
// Hapi
196205
const hFake = {
197206
response(source) {
@@ -348,6 +357,7 @@ export {
348357
generateValidRequestAuthorizationHeaderForApplication,
349358
hFake,
350359
HttpTestServer,
360+
insertMultipleSendingFeatureForNewOrganization,
351361
insertOrganizationUserWithRoleAdmin,
352362
insertUserWithRoleCertif,
353363
insertUserWithRoleSuperAdmin,

0 commit comments

Comments
 (0)