當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript testing.TestingModule類代碼示例

本文整理匯總了TypeScript中@nestjs/testing.TestingModule的典型用法代碼示例。如果您正苦於以下問題:TypeScript TestingModule類的具體用法?TypeScript TestingModule怎麽用?TypeScript TestingModule使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TestingModule類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: beforeEach

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      providers: [ScoreService],
    }).compile();

    service = module.get<ScoreService>(ScoreService);
  });
開發者ID:InsaneWookie,項目名稱:mame-highscores,代碼行數:7,代碼來源:score.service.spec.ts

示例2: beforeEach

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      controllers: [ScoreController],
    }).compile();

    controller = module.get<ScoreController>(ScoreController);
  });
開發者ID:InsaneWookie,項目名稱:mame-highscores,代碼行數:7,代碼來源:score.controller.spec.ts

示例3: beforeEach

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      imports: [
        JwtModule.register({
          secretOrPrivateKey: 'test',
          signOptions: {
            expiresIn: 3600,
          },
        }),
        PassportModule.register({ defaultStrategy: 'jwt' }),

      ],
      controllers: [AuthController],
      providers: [
        AuthService,
        UserService,
        GroupService,
        MachineService,
        JwtStrategy,
        {
          provide: ConfigService,
          useValue: new ConfigService(`${process.env.NODE_ENV || 'development'}.env`),
        },
        { provide: getRepositoryToken(User), useClass: Repository,},
        { provide: getRepositoryToken(Group), useClass: Repository,},
        { provide: getRepositoryToken(Machine), useClass: Repository,},
        { provide: getRepositoryToken(UserGroup), useClass: Repository,},
      ]
    }).compile();

    controller = module.get<AuthController>(AuthController);
  });
開發者ID:InsaneWookie,項目名稱:mame-highscores,代碼行數:32,代碼來源:auth.controller.spec.ts

示例4: beforeEach

  beforeEach(async () => {
    const testModule: TestingModule = await Test.createTestingModule({
      providers: [
        ...databaseProviders,
        ...dictionaryEntryProviders,
        DictinaryEntryService,
        DictionaryEntryResolver,
        AuthGuard,
        {
          provide: Types.CONFIG,
          useValue: {
            mongoConnectionUri: `mongodb://localhost:27017/TEST_${uuidv4()}`,
            secureApiToken: 'test_token',
          },
        },
      ],
    }).compile();

    connection = await prepareDatabaseScenario(testModule, [
      createDataFor<DictionaryEntryEntity>(DictionaryEntryEntity, [
        { japanese: 'inu', english: 'dog' },
        { japanese: 'neko', english: 'cat' },
      ]),
    ]);

    dictionaryEntryResolver = testModule.get<DictionaryEntryResolver>(
      DictionaryEntryResolver,
    );
  });
開發者ID:vnenkpet,項目名稱:japanese,代碼行數:29,代碼來源:dictionary-entry.resolver.spec.ts

示例5: beforeEach

  beforeEach(async () => {
    const app: TestingModule = await Test.createTestingModule({
      controllers: [AppController],
      providers: [AppService],
    }).compile()

    appController = app.get<AppController>(AppController)
  })
開發者ID:coderhaoxin,項目名稱:tiny-demos,代碼行數:8,代碼來源:app.controller.spec.ts

示例6: beforeEach

  beforeEach(async () => {
    const moduleFixture: TestingModule = await Test.createTestingModule({
      imports: [AppModule],
    }).compile();

    app = moduleFixture.createNestApplication();
    await app.init();
  });
開發者ID:elisiondesign,項目名稱:meteo-api,代碼行數:8,代碼來源:app.e2e-spec.ts

示例7: beforeAll

 beforeAll(async () => {
   const module: TestingModule = await Test.createTestingModule({
     providers: [{
       provide: ConfigService,
       useValue: new ConfigService(`${process.env.NODE_ENV}.env`),
     }],
   }).compile();
   service = module.get<ConfigService>(ConfigService);
 });
開發者ID:rummik,項目名稱:9k1.us,代碼行數:9,代碼來源:config.service.spec.ts

示例8: beforeAll

 beforeAll(async () => {
   const module: TestingModule = await Test.createTestingModule({
     providers: [
       ConfigurationService,
       { provide: 'ConfigurationRepository', useClass: ConfigurationRepository },
     ],
   }).compile();
   service = module.get<ConfigurationService>(ConfigurationService);
 });
開發者ID:OysteinAmundsen,項目名稱:gymsystems,代碼行數:9,代碼來源:configuration.service.spec.ts

示例9: beforeEach

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      providers: [
        MachineService,
        {provide: getRepositoryToken(Machine), useClass: Repository,},
        {provide: getRepositoryToken(Group), useClass: Repository,},],
    }).compile();

    service = module.get<MachineService>(MachineService);
  });
開發者ID:InsaneWookie,項目名稱:mame-highscores,代碼行數:10,代碼來源:machine.service.spec.ts

示例10: beforeAll

 beforeAll(async () => {
   const module: TestingModule = await Test.createTestingModule({
     providers: [
       GymnastService,
       { provide: 'GymnastRepository', useClass: GymnastRepository },
       { provide: 'PubSubInstance', useValue: new PubSub() }
     ],
   }).compile();
   service = module.get<GymnastService>(GymnastService);
 });
開發者ID:OysteinAmundsen,項目名稱:gymsystems,代碼行數:10,代碼來源:gymnast.service.spec.ts


注:本文中的@nestjs/testing.TestingModule類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。