当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript assert.isAtLeast方法代码示例

本文整理汇总了TypeScript中chai.assert.isAtLeast方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.isAtLeast方法的具体用法?TypeScript assert.isAtLeast怎么用?TypeScript assert.isAtLeast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chai.assert的用法示例。


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

示例1: invalidOrder

 @test('Inserting a new transaction fails if OrderId is invalid')
 public async invalidOrder() {
   let db = await getDb();
   let errors: string[] = [];
   try {
     let transaction = await db.run(
       sql`
   INSERT INTO CustomerOrderTransaction(auth, orderid) VALUES ($1, $2)`,
       'lk1hdklh12ld',
       191927158
     );
     assert.ok(false, 'Should have encountered a foreign key constraint error');
   } catch (e) {
     errors.push(e.toString());
   }
   assert.isAtLeast(
     errors.length,
     1,
     'At least one error (foreign key constraint violation) should have been thrown'
   );
   assert.include(
     errors[0].toLowerCase(),
     'foreign key',
     'Error message says something about "foreign key'
   );
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:26,代码来源:ex10.transactions-table.test.ts

示例2: it

  it('should wait at least 2 seconds', async () => {
    const now = new Date().getTime();
    const in2secs = now + 2000;

    await wait(2000);

    assert.isAtLeast(new Date().getTime(), in2secs);
  });
开发者ID:brunolm,项目名称:desbravando-typescript,代码行数:8,代码来源:example02.ts

示例3: it

 it('should create a Redux store that responds to actions', (done: MochaDone) => {
   const store = createReduxStore();
   const state = store.getState();
   assert.isAtLeast(Object.keys(state).length, 1);
   const unsubscribe = store.subscribe(() => done());
   store.dispatch({type: 'testAction'} as any);
   unsubscribe();
 });
开发者ID:agaricus,项目名称:ear-sharpener,代码行数:8,代码来源:test.ts

示例4: assertMigrationCount

export function assertMigrationCount(
  migrationCount: number,
  sqlsCount = migrationCount
) {
  assert.ok(
    fs.existsSync(path.join(__dirname, '..', '..', 'migrations')),
    './migrations folder exists'
  );
  let migrationsFiles = fs.readdirSync(
    path.join(__dirname, '..', '..', 'migrations')
  );
  assert.ok(
    fs.existsSync(path.join(__dirname, '..', '..', 'migrations', 'sqls')),
    './sqls folder exists'
  );
  assert.includeDeepMembers(
    migrationsFiles,
    ['sqls', '20171203034929-first.ts'],
    './migrations folder contains sqls folder and first migration'
  );
  assert.isAtLeast(
    migrationsFiles.length,
    migrationCount,
    `There are at least ${migrationCount} things in the ./migrations folder`
  );
  let migrationsSqlsFiles = fs.readdirSync(
    path.join(__dirname, '..', '..', 'migrations', 'sqls')
  );
  assert.isAtLeast(
    migrationsSqlsFiles.length,
    sqlsCount,
    `There are at least ${sqlsCount} things in the ./migrations/sqls folder`
  );
  let downMigrationCount = 0;
  let upMigrationCount = 0;
  migrationsSqlsFiles.forEach(fileName => {
    if (fileName.includes('-down')) {
      downMigrationCount++;
    }
    if (fileName.includes('-up')) {
      upMigrationCount++;
    }
  });
}
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:44,代码来源:migrations.ts

示例5: it

    it("should verify parse Exe output - delete a file that doesn't exist - error exit code", async function() {
        const noChangesPaths: string[] = [path.join("folder1", "folder2", "foo.txt")];
        const localPaths: string[] = noChangesPaths;
        const cmd: Delete = new Delete(undefined, localPaths);
        const executionResult: IExecutionResult = {
            exitCode: 100,
            stdout: "The item C:\\repos\\Tfvc.L2VSCodeExtension.RC\\folder1\\folder2\\foo.txt could not be found in your workspace, or you do not have permission to access it.\n" +
                "No arguments matched any files to delete.\n",
            stderr: undefined
        };

        try {
            await cmd.ParseExeOutput(executionResult);
        } catch (err) {
            assert.equal(err.exitCode, 100);
            assert.equal(err.tfvcCommand, "delete");
            assert.isAtLeast(err.stdout.indexOf("could not be found in your workspace"), 0);
            assert.isAtLeast(err.stdout.indexOf("No arguments matched any files to delete"), 0);
        }
    });
开发者ID:creativewebmatrixsolutions,项目名称:vsts-vscode,代码行数:20,代码来源:delete.test.ts

示例6: createOrderForValidData

 @test('createOrder() creates an order successfully for valid data')
 public async createOrderForValidData() {
   let o = await createOrder(VALID_ORDER_DATA as any);
   assert.ok(o, 'returns a promise that resolves to a non-empty vale');
   assert.ok(o.id, 'returns a promise that resolves to something with an id property');
   assert.isAtLeast(
     parseInt(o.id as string, 10),
     1,
     'returns a promise that resolves to something with a numeric id property, whose value is > 1'
   );
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:11,代码来源:ex06.create-order.test.ts

示例7: allProducts

 @test('getAllProducts() (no filter) still works as expected')
 public async allProducts() {
   let result = await getAllProducts();
   assert.isArray(result, 'Expected result to be an array');
   // TODO: tighten assertion
   assert.isAtLeast(
     result.length,
     50,
     'Expected at least 50 products in array'
   );
   assertProductCols(result[0]);
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:12,代码来源:ex02.filtering-products.test.ts

示例8: allProducts

 @test('All products')
 public async allProducts() {
   let result = await getAllProducts();
   assert.isArray(result, 'Expected result to be an array');
   // TODO: tighten assertion
   assert.isAtLeast(result.length, 50, 'Expected at least 50 products in array');
   validateRecordColumns(
     { recordType: 'product', functionName: 'getAllProducts' },
     result[3],
     REQUIRED_PRODUCT_LIST_COLS,
     FORBIDDEN_PRODUCT_LIST_COLS
   );
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:13,代码来源:ex01.collection-cols.test.ts

示例9: filteredCustomers1

 @test('filter="fre" returns subset of results')
 public async filteredCustomers1() {
   let result = await getAllCustomers({ filter: 'fre' });
   assert.isArray(result, 'Expected result to be an array');
   assert.isAtLeast(result.length, 3, 'Expected 3 or more customers in array');
   assert.isAtMost(result.length, 5, 'Expected 5 or fewer customers in array');
   validateRecordColumns(
     {
       recordType: 'customer',
       functionName: 'getAllCustomers({ filter: "fre" })'
     },
     result[0],
     ALL_CUSTOMERS_REQUIRED_COLS,
     []
   );
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:16,代码来源:ex02.filtering-cutomers.test.ts

示例10:

      fetchMock.mock("/ts/query", "post", (url: string, requestObj: RequestInit) => {
          // Assert that metric store's "inFlight" is 1 or 2.
          assert.isAtLeast(mockMetricsState.inFlight, 1);
          assert.isAtMost(mockMetricsState.inFlight, 1);

          let request = JSON.parse(requestObj.body as string) as TSRequest;
          return {
            body: {
              results: _.map(request.queries, (q) => {
                return {
                  query: q,
                  datapoints: [],
                };
              }),
            },
          };
      });
开发者ID:WillHaack,项目名称:cockroach,代码行数:17,代码来源:metrics.spec.ts

示例11:

        response: (url: string, requestObj: RequestInit) => {
          // Assert that metric store's "inFlight" is 1 or 2.
          assert.isAtLeast(mockMetricsState.inFlight, 1);
          assert.isAtMost(mockMetricsState.inFlight, 2);

          let request = protos.cockroach.ts.tspb.TimeSeriesQueryRequest.decode(requestObj.body as ArrayBuffer);

          return {
            body: new protos.cockroach.ts.tspb.TimeSeriesQueryResponse({
              results: _.map(request.queries, (q) => {
                return {
                  query: q,
                  datapoints: [],
                };
              }),
            }).toArrayBuffer(),
          };
        },
开发者ID:martinpinto,项目名称:cockroach,代码行数:18,代码来源:metrics.spec.ts

示例12: discontinuedProducts

 @test(
   'getAllProducts({ filter: { inventory: "discontinued" } }) only returns discontinued items'
 )
 public async discontinuedProducts() {
   let result = await getAllProducts({
     filter: { inventory: 'discontinued' }
   });
   assert.isArray(result, 'Expected result to be an array');
   // TODO: tighten assertion
   assert.isAtLeast(result.length, 5, 'Expected at least 5 products in array');
   assertProductCols(result[0]);
   let numDiscontinued = result.filter(r => r.discontinued).length;
   assert.equal(
     numDiscontinued,
     result.length,
     'All items in result set are discontinued'
   );
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:18,代码来源:ex02.filtering-products.test.ts

示例13: duplicateCheck

 @test('Attempting to add two OrderDetail items to the same order with the same product fails')
 public async duplicateCheck() {
   let errors: string[] = [];
   try {
     await createOrder(VALID_ORDER_DATA, [
       { productid: 11, quantity: 3, discount: 0, unitprice: 3.0 },
       { productid: 11, quantity: 8, discount: 0, unitprice: 3.0 }
     ]);
     assert.ok(false, 'Error should have been thrown');
   } catch (e) {
     errors.push(e.toString());
   }
   assert.isAtLeast(errors.length, 1, 'At least one error was thrown');
   assert.include(
     errors[0].toLowerCase(),
     'unique',
     'Error message mentions something about a "unique" constraint'
   );
 }
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:19,代码来源:ex10.unique-indices.test.ts

示例14:

      fetchMock.mock("/ts/query", "post", (url: string, requestObj: RequestInit) => {
          // Assert that metric store's "inFlight" is 1 or 2.
          assert.isAtLeast(mockMetricsState.inFlight, 1);
          assert.isAtMost(mockMetricsState.inFlight, 1);

          let request = new protos.cockroach.ts.tspb.TimeSeriesQueryRequest(JSON.parse(requestObj.body as string));

          return {
            sendAsJson: false,
            body: new protos.cockroach.ts.tspb.TimeSeriesQueryResponse({
              results: _.map(request.queries, (q) => {
                return {
                  query: q,
                  datapoints: [],
                };
              }),
            }).encodeJSON(),
          };
      });
开发者ID:codepope,项目名称:cockroach,代码行数:19,代码来源:metrics.spec.ts

示例15:

 .then(() => {
   const user: IConfigUser = config.get('user');
   assert.equal(user.access_token, expectedAuth.access_token);
   assert.equal(user.refresh_token, expectedAuth.refresh_token);
   assert.isAtLeast(user.expires_at!, Date.now());
 });
开发者ID:kevoree,项目名称:kevoree-js,代码行数:6,代码来源:auth.ts


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