Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeAll(() => __awaiter(this, void 0, void 0, function* () {
logger.trace('---- Starting Auth e2e ----');
yield test_object_literals_constants_1.setupTestDataJwtTokens(nestjs_bff_config_1.NestjsBffConfig);
// console.log('Auth-testData', JSON.stringify(testData, null, 2));
const module = yield testing_1.Test.createTestingModule({
imports: [auth_e2e_module_1.AuthE2eModule],
}).compile();
app = module.createNestApplication();
yield app.init();
httpServer = app.getHttpServer();
}), 5 * 60 * 1000);
//
exports.setupAuth = (globalConfig, nestJsBffConfig) => __awaiter(this, void 0, void 0, function* () {
const logger = logging_shared_module_1.getLogger();
//
// Setup
//
const module = yield testing_1.Test.createTestingModule({
imports: [auth_e2e_module_1.AuthE2eModule],
}).compile();
const app = module.createNestApplication();
yield app.init();
const authenticationRepo = yield app.get(authentication_repo_1.AuthenticationRepo);
const organizationRepo = yield app.get(organization_repo_1.OrganizationRepo);
const userRepo = yield app.get(user_repo_1.UserRepo);
const accessPermissionsRepo = yield app.get(access_permissions_repo_1.AccessPermissionsRepo);
//
// Add Data
//
// OrgA
yield organizationRepo.create(test_object_literals_constants_1.testData.orgA.orgEntity, { skipAuthorization: true });
// OrgA Admin User
yield userRepo.create(test_object_literals_constants_1.testData.orgA.users.adminUser.userEntity, { skipAuthorization: true });
yield authenticationRepo.create(test_object_literals_constants_1.testData.orgA.users.adminUser.authenticationEntity, { skipAuthorization: true });
it(`should validate loaded env variables`, async () => {
try {
const module = await Test.createTestingModule({
imports: [AppModule.withSchemaValidation()],
}).compile();
app = module.createNestApplication();
await app.init();
} catch (err) {
expect(err.message).toEqual(
'Config validation error: "PORT" is required. "DATABASE_NAME" is required',
);
}
});
});
beforeAll(async () => {
const module = await Test.createTestingModule({
imports: [ApplicationModule]
}).compile();
app = module.createNestApplication();
loggerService = app.get(LoggerService);
await app.init();
})
it(`insert`, async () => {
beforeEach(async () => {
app = await Test.createTestingModule({
imports: [DiscoveryModule, ExampleModule]
}).compile();
await app.init();
});
it('should return the queue matching the given token', async () => {
const queueToken = getQueueToken('test');
const fakeQueue = 'I am a fake queue';
const module = await Test.createTestingModule({
imports: [BullModule.forRoot({ name: 'test' })],
})
.overrideProvider(queueToken)
.useValue(fakeQueue)
.compile();
const moduleRef = module.get(ModuleRef);
const queue = BullExplorer.getQueue(moduleRef, queueToken);
expect(queue).toBeDefined();
expect(queue).toBe(fakeQueue);
});
});
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [StaticController],
}).compile();
controller = module.get(StaticController);
});
beforeAll(async () => {
app = await Test.createTestingModule({
controllers: [AppController],
providers: [CartService, ProductService, ShippingService]
}).compile();
});