@test('getOrder() result must now include customername and employeename columns')
 public async getOrderColumnTest() {
   let firstPageResult = await getOrder(10300);
   assert.containsAllKeys(firstPageResult, ['customername', 'employeename']);
   assert.ok((firstPageResult as any).customername);
   assert.ok((firstPageResult as any).employeename);
 }
 @test('getAllOrders() results must now include customername and employeename columns')
 public async allOrdersColumnTest() {
   let firstPageResult = await getAllOrders();
   assert.containsAllKeys(firstPageResult[0], ['customername', 'employeename']);
   assert.ok((firstPageResult[0] as any).customername);
   assert.ok((firstPageResult[0] as any).employeename);
 }
  @test('using order="desc" (and specifying no column to sort on) sorts decending by shippeddate')
  public async orderListDesc() {
    let firstPageResult = await getCustomerOrders('ANTON', {
      perPage: 3,
      order: 'desc'
    });
    assert.containsAllKeys(firstPageResult[0], ['shippeddate']);

    let sortedById = orderBy(firstPageResult, 'shippeddate', 'desc');
    assert.deepEqual(firstPageResult, sortedById);
  }
Пример #4
0
 @test('[MYSQL ONLY] Generated columns for flavors are found on product table')
 @onlyForDatabaseTypes(DbType.MySQL)
 public async mySQLGeneratedColumnsPresent() {
   let db = await getDb();
   let p = await db.get(sql`SELECT * from Product WHERE id=1`);
   assert.containsAllKeys(
     p,
     ['spicy', 'sweet', 'sour', 'salty', 'bitter'],
     'salty, sweet, sour, spicy and bitter columns are present on Product table'
   );
 }
 @test(
   'getAllProducts() results must now include categoryname and suppliername columns'
 )
 public async allProductsColumnTest() {
   let firstPageResult = await getAllProducts();
   assert.containsAllKeys(firstPageResult[0], [
     'suppliername',
     'categoryname'
   ]);
   assert.ok((firstPageResult[0] as any).suppliername);
   assert.ok((firstPageResult[0] as any).categoryname);
 }
 @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);
 }
function assertProductCols(item: any) {
  assert.containsAllKeys(
    item,
    [
      'id',
      'categoryid',
      'discontinued',
      'productname',
      'quantityperunit',
      'reorderlevel',
      'supplierid',
      'unitprice',
      'unitsinstock',
      'unitsonorder'
    ], // tslint:disable-next-line:max-line-length
    'each DB result has properties id, categoryid, discontinued, productname, quantityperunit, reorderlevel, supplierid, unitprice, unitsinstock, unitsonorder'
  );
}
Пример #8
0
  it("should call with current continuation with additional arguments", async () => {
    const context = new MetaesContext(undefined, undefined, {
      values: { callWithCurrentContinuation, receiver }
    });

    let env;
    function receiver(_, cc, _cerr, environment) {
      // remember environment for later check
      env = environment;
      // intentionally continue a bit later
      setTimeout(cc, 0, 21);
    }

    const result = await evalFunctionBodyAsPromise({
      context,
      source: callWithCurrentContinuation => 2 * callWithCurrentContinuation(receiver)
    });
    assert.equal(result, 42);
    assert.containsAllKeys(env, ["values"]);
  });
 @test('getOrderDetails() result must now include productname column')
 public async getOrderDetailsColumnTest() {
   let firstPageResult = await getOrderDetails(10300);
   assert.containsAllKeys(firstPageResult[0], ['productname']);
   assert.ok((firstPageResult[0] as any).productname);
 }
 @test('getOrder() results must now include subtotal')
 public async orderSubtotalPresent() {
   let orderResult = await getOrder(10248);
   assert.containsAllKeys(orderResult, ['subtotal']);
 }