async () => { const wctCliRunStub = sandbox.stub(wct.cli, 'run').returns(Promise.resolve()); const cli = new PolymerCli(['test', '--npm']); await cli.run(); const wctArgs = wctCliRunStub.args[0][1]; assert.includeMembers(wctCliRunStub.args[0][1], ['--npm']); assert.includeMembers(wctArgs, [`--component-dir='node_modules/'`]); });
return helper.listDefPaths(info.typingsDir).then((typings:string[]) => { assert.includeMembers(typings, context.config.getInstalledPaths(), 'saved installed file'); if (test.modify && test.modify.written) { var writenPaths = tsd.DefUtil.getPathsOf(xm.valuesOf(result.written)); assert.sameMembers(writenPaths.sort(), test.modify.written.sort(), 'written: files'); } });
export async function assertViewsExist(db: SQLDatabase, viewNames: string[]) { let allViews = await db.getAllViews(); assert.includeMembers( allViews.map(s => s.toLowerCase()), viewNames.map(s => s.toLowerCase()), `${viewNames.join(', ')} view(s) found` ); }
export async function assertTableExists(db: SQLDatabase, tableName: string) { let allTables = await db.getAllTableNames(); assert.includeMembers( allTables.map(t => t.toLowerCase()), [tableName], `${tableName} table is found` ); }
test('--module-resolution flag is passed to WCT', async () => { const wctCliRunStub = sinon.stub(wct.cli, 'run').returns(Promise.resolve()); const cli = new PolymerCli(['test', '--module-resolution=none']); await cli.run(); const wctArgs = wctCliRunStub.args[0][1]; assert.includeMembers(wctArgs, [`--module-resolution=none`]); });
@test('Function table_update_notify is found') public async productIndicesPresent() { let db = await getDb(); let indexInfo = await db.getAllFunctions(); assert.includeMembers(indexInfo.map(s => s.toLowerCase()), [ 'table_update_notify' ]); }
@test('Creating an order results in a refreshAll') public async productIndicesPresent() { let db = await getDb(); let indexInfo = await db.getAllFunctions(); assert.includeMembers(indexInfo.map(s => s.toLowerCase()), [ 'table_update_notify' ]); }
test('--component-dir flag is passed to WCT', async () => { const wctCliRunStub = sinon.stub(wct.cli, 'run').returns(Promise.resolve()); const cli = new PolymerCli(['test', '--component-dir=path/to/deps/']); await cli.run(); const wctArgs = wctCliRunStub.args[0][1]; assert.isOk(!wctArgs.includes('--npm')); assert.includeMembers(wctArgs, [`--component-dir='path/to/deps/'`]); });
export async function assertTriggersExist( db: SQLDatabase, triggerNames: string[] ) { let allTriggers = await db.getAllTriggers(); assert.includeMembers( allTriggers.map(s => s.toLowerCase()), triggerNames.map(s => s.toLowerCase()), `${triggerNames.join(', ')} trigger(s) found` ); }
@test('Querying the view yields expected results') public async viewResults() { let db = await getDb(); let result = await db.get(sql`SELECT * from SupplierList_V`); assert.ok(result, 'Results of query are truthy'); assert.includeMembers( Object.keys(result), ['id', 'companyname', 'contactname', 'productlist'], "Columns: 'id', 'companyname', 'contactname', 'productlist'" ); }