本文整理汇总了TypeScript中ava.test.serial方法的典型用法代码示例。如果您正苦于以下问题:TypeScript test.serial方法的具体用法?TypeScript test.serial怎么用?TypeScript test.serial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ava.test
的用法示例。
在下文中一共展示了test.serial方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
// @service('testservice')
class TestClass {
constructor(protected test1: string, test2: boolean, test3: number) {}
}
t.pass()
})
test.serial('Singleton', async t => {
let container = new DIContainer()
let cont2 = new DIContainer()
t.not(container, cont2)
container = DIContainer.getContainer()
t.throws(
() => new DIContainer(),
/singleton - please user DIContainer.getContainer()/
)
cont2 = DIContainer.getContainer()
t.is(container, cont2)
cont2.destroy()
})
test('Register Value with token', t => {
const cont = new DIContainer()
const TOKEN = Symbol('token')
const value = 'HELLO WORLD'
cont.registerValue(TOKEN, value)
const result = cont.resolve(TOKEN)
示例2: start
import { test } from "ava"
import { smallScenario, mediumScenario, largeScenario } from "./perf/scenarios"
import { start } from "./perf/timer"
// TODO: Not sure how this should work. This feels super fragile.
const TOO_SLOW_MS = 10000
test.serial("performs well on small scenario", t => {
t.true(smallScenario(10).elapsed < TOO_SLOW_MS)
})
test.serial("performs well on medium scenario", t => {
t.true(mediumScenario(10).elapsed < TOO_SLOW_MS)
})
test.serial("performs well on large scenario", t => {
t.true(largeScenario(10, 0, 0).elapsed < TOO_SLOW_MS)
t.true(largeScenario(10, 10, 0).elapsed < TOO_SLOW_MS)
t.true(largeScenario(10, 0, 10).elapsed < TOO_SLOW_MS)
t.true(largeScenario(10, 10, 10).elapsed < TOO_SLOW_MS)
})
test.cb("timer", t => {
const go = start()
setTimeout(function() {
const lap = go(true)
setTimeout(function() {
const done = go()
t.not(lap, 0)
t.not(done, 0)
t.not(lap, done)
示例3: test
test(`Pully#download requires a URL`, async (t) => {
const p = new Pully();
t.plan(3);
await t.throws(p.download(null));
await t.throws(p.download(null, 'hd'));
await t.throws(p.download({ url: null }));
});
test.serial(`Pully#download defaults to 'hd' preset`, async (t) => {
const p = new Pully();
const result = await p.download(testVideo);
downloadedFiles.add(result.path);
t.is(typeof result.path, 'string');
t.is(result.format.video.resolution, 1080);
t.true(result.path.endsWith('.mp4'));
});
test.serial(`Pully#download accepts a template string`, async (t) => {
const p = new Pully();
const result = await p.download({
url: testVideo,
dir: tempPath,
template: '${videoId} - ${videoTitle}'
});
downloadedFiles.add(result.path);