本文整理匯總了TypeScript中denali-cli.CommandAcceptanceTest類的典型用法代碼示例。如果您正苦於以下問題:TypeScript CommandAcceptanceTest類的具體用法?TypeScript CommandAcceptanceTest怎麽用?TypeScript CommandAcceptanceTest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了CommandAcceptanceTest類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: async
test.beforeEach('generate an action to destroy', async (t) => {
let generate = new CommandAcceptanceTest('generate action foobar', { name: 'destroy-command' });
t.context.dir = generate.dir;
t.context.generatedFilepath = path.join(generate.dir, 'app', 'actions', 'foobar.js');
await generate.run();
t.true(fs.existsSync(t.context.generatedFilepath), 'file should be generated');
});
示例2: test
test('generates a blueprint', async (t) => {
let generate = new CommandAcceptanceTest('generate action foobar --skip-post-install', { name: 'generate-command' });
let generatedFilepath = path.join(generate.dir, 'app', 'actions', 'foobar.js');
await generate.run({ failOnStderr: true });
t.true(fs.existsSync(generatedFilepath), 'file should be generated');
});
示例3: test
test('skips modified files', async (t) => {
let destroy = new CommandAcceptanceTest('destroy action foobar', { dir: t.context.dir, populateWithDummy: false });
fs.appendFileSync(t.context.generatedFilepath, 'foobar');
await destroy.run();
t.true(fs.existsSync(t.context.generatedFilepath), 'file should be generated');
});
示例4: test
test('prints list of configured routes', async (t) => {
let generate = new CommandAcceptanceTest('routes', { name: 'routes-command' });
let result = await generate.run({ failOnStderr: true });
t.true(result.stdout.trim().endsWith(dedent`
┌───────┬────────┐
│ URL │ ACTION │
├───────┼────────┤
│ GET / │ index │
└───────┴────────┘
`.trim()));
});
示例5: test
test('launches a server', async (t) => {
let server = new CommandAcceptanceTest('server --port 3001', { name: 'server-command' });
return server.spawn({
failOnStderr: true,
env: {
DEBUG: null
},
checkOutput(stdout) {
let started = stdout.indexOf('dummy@0.0.0 server up') > -1;
if (started) {
t.pass();
}
return started;
}
});
});