• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript mocha-typescript.test函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中mocha-typescript.test函数的典型用法代码示例。如果您正苦于以下问题:TypeScript test函数的具体用法?TypeScript test怎么用?TypeScript test使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了test函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: productLeaderboardTest

 @test('Product leaderboard query')
 public async productLeaderboardTest() {
   let result = await getProductSalesLeaderboard();
   assert.isArray(result, 'Expected result to be an array');
   assert.equal(result.length, 5, 'Expected exactly 5 products');
   validateRecordColumns(
     {
       recordType: 'product-leaderboard',
       functionName: 'getProductSalesLeaderboard'
     },
     result[3],
     ['name', 'amount']
   );
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:14,代码来源:ex00.initial-dashboard.test.ts


示例2: employeeLeaderboardTest

 @test('Employee leaderboard query')
 public async employeeLeaderboardTest() {
   let result = await getEmployeeSalesLeaderboard();
   assert.isArray(result, 'Expected result to be an array');
   assert.equal(result.length, 5, 'Expected exactly 5 employees');
   validateRecordColumns(
     {
       recordType: 'employee-leaderboard',
       functionName: 'getEmployeeSalesLeaderboard'
     },
     result[3],
     ['name', 'amount']
   );
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:14,代码来源:ex00.initial-dashboard.test.ts


示例3: reorderableProductsColumnTest

 @test(
   'getAllProducts({ filter: { inventory: "needs-reorder" } }) results must now include categoryname and suppliername columns'
 )
 public async reorderableProductsColumnTest() {
   let firstPageResult = await getAllProducts({
     filter: { inventory: 'needs-reorder' }
   });
   assert.containsAllKeys(firstPageResult[0], [
     'suppliername',
     'categoryname'
   ]);
   assert.ok((firstPageResult[0] as any).suppliername);
   assert.ok((firstPageResult[0] as any).categoryname);
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:14,代码来源:ex04.products-join.test.ts


示例4: suite

suite('util/ReadyGate', () => {
  test('ReadyGate is ready by default', () => {
    const gate = new ReadyGate();
    gate.isChannelReady().must.be.true();
  });
  test('Once it\'s marked as not ready it comes back as not ready', () => {
    const gate = new ReadyGate();
    gate.channelNotReady();
    gate.isChannelReady().must.be.false();
  });
  test('Once it\'s marked as ready it comes back as ready', () => {
    const gate = new ReadyGate();
    gate.channelNotReady();
    gate.channelReady();
    gate.isChannelReady().must.be.true();
  });
  test('Await returns immediately if the gate is ready', async () => {
    const gate = new ReadyGate();
    const ready = {ready: false};
    const promise = gate.awaitChannelReady().then(() => { ready.ready = true; });
    await new Promise<void>((resolve) => { setTimeout(resolve, 0);});
    ready.ready.must.be.true();
  });

  test('Await does not return immediately if the gate is not ready', async () => {
    const gate = new ReadyGate();
    gate.channelNotReady();
    const ready = {ready: false};
    gate.awaitChannelReady().then(() => { ready.ready = true; });
    await new Promise<void>((resolve) => { setTimeout(resolve, 50);});
    ready.ready.must.be.false();
    gate.channelReady();
    gate.awaitChannelReady().then(() => { ready.ready = true; });
    await new Promise<void>((resolve) => { setTimeout(resolve, 0);});
    ready.ready.must.be.true();
  });
});
开发者ID:yruan,项目名称:inceptum,代码行数:37,代码来源:ReadyGateTest.ts


示例5: allCustomers

 @test('Get all customers')
 public async allCustomers() {
   let result = await getAllCustomers();
   assert.isArray(result, 'Expected result to be an array');
   assert.isAbove(
     result.length,
     40,
     'Expected more than 40 customers in array'
   );
   validateRecordColumns(
     { recordType: 'customer', functionName: 'getAllCustomers' },
     result[2],
     REQUIRED_CUSTOMER_LIST_COLS
   );
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:15,代码来源:ex00.initial-queries.test.ts


示例6: offset

  @test('When perPage = 20, page 2 starts at item 20')
  public async offset() {
    let first40Result = await getAllOrders({ perPage: 40, page: 1 });
    let first20Result = await getAllOrders({ perPage: 20, page: 1 });
    let second20Result = await getAllOrders({ perPage: 20, page: 2 });

    assert.isArray(second20Result, 'Expected result to be an array');
    assert.equal(second20Result.length, 20, 'Expected 20 orders in array');

    assert.deepEqual(
      second20Result[0],
      first40Result[20],
      'First item on the second page of 20 is the 20th item on the first page of 40'
    );
  }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:15,代码来源:ex03.pagination-all-orders.test.ts


示例7: suite

suite('mysql/MysqlHealthCheck', () => {
  test('Readonly flag is passed (true)', async () => {
    const check = new MySQLHealthCheck('testCheck', true);
    const mockedMysqlClient = mock(MySQLClient);
    when(mockedMysqlClient.ping(anything())).thenReturn(Promise.resolve(undefined));
    check.mysqlClient = instance(mockedMysqlClient);
    await check.doCheck();
    verify(mockedMysqlClient.ping(true)).once();
  });
  test('Readonly flag is passed (false)', async () => {
    const check = new MySQLHealthCheck('testCheck', false);
    const mockedMysqlClient = mock(MySQLClient);
    when(mockedMysqlClient.ping(anything())).thenReturn(Promise.resolve(undefined));
    check.mysqlClient = instance(mockedMysqlClient);
    await check.doCheck();
    verify(mockedMysqlClient.ping(false)).once();
  });
  test('OKs on success', async () => {
    const check = new MySQLHealthCheck('testCheck', false);
    const mockedMysqlClient = mock(MySQLClient);
    when(mockedMysqlClient.ping(anything())).thenReturn(Promise.resolve(undefined));
    check.mysqlClient = instance(mockedMysqlClient);
    await check.runCheck();
    const result = check.getLastResult();
    result.status.must.equal(HealthCheckStatus.OK);
  });
  test('CRITICAL on exception', async () => {
    const check = new MySQLHealthCheck('testCheck', false);
    const mockedMysqlClient = mock(MySQLClient);
    when(mockedMysqlClient.ping(anything())).thenThrow(new Error('Error'));
    check.mysqlClient = instance(mockedMysqlClient);
    await check.runCheck();
    const result = check.getLastResult();
    result.status.must.equal(HealthCheckStatus.CRITICAL);
  });
});
开发者ID:yruan,项目名称:inceptum,代码行数:36,代码来源:MySQLHealthCheck.ts


示例8: allProducts

 @test('Get all products')
 public async allProducts() {
   let result = await getAllProducts();
   assert.isArray(result, 'Expected result to be an array');
   assert.isAbove(
     result.length,
     20,
     'Expected more than 20 products in array'
   );
   validateRecordColumns(
     { recordType: 'product', functionName: 'getAllProducts' },
     result[3],
     REQUIRED_PRODUCT_LIST_COLS
   );
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:15,代码来源:ex00.initial-queries.test.ts


示例9: allSuppliers

 @test('Get all suppliers')
 public async allSuppliers() {
   let result = await getAllSuppliers();
   assert.isArray(result, 'Expected result to be an array');
   assert.isAbove(
     result.length,
     20,
     'Expected more than 20 suppliers in array'
   );
   validateRecordColumns(
     { recordType: 'supplier', functionName: 'getAllSuppliers' },
     result[3],
     REQUIRED_SUPPLIER_LIST_COLS
   );
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:15,代码来源:ex00.initial-queries.test.ts


示例10: allOrders

 @test('Get all orders')
 public async allOrders() {
   let result = await getAllOrders({ perPage: 50000 });
   assert.isArray(result, 'Expected result to be an array');
   assert.isAbove(
     result.length,
     800,
     'Expected more than 800 orders in array'
   );
   validateRecordColumns(
     { recordType: 'order', functionName: 'getAllOrders' },
     result[2],
     REQUIRED_ORDER_LIST_COLS
   );
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:15,代码来源:ex00.initial-queries.test.ts



注:本文中的mocha-typescript.test函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript mocha-typescript.timeout函数代码示例发布时间:2022-05-25
下一篇:
TypeScript mocha-typescript.suite函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap