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


TypeScript test.serial方法代码示例

本文整理汇总了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)
开发者ID:ha4us,项目名称:ha4us.old,代码行数:32,代码来源:di.spec.ts

示例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)
开发者ID:lelandyolo,项目名称:mobx-state-tree,代码行数:31,代码来源:perf.ts

示例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);
开发者ID:JimmyBoh,项目名称:pully,代码行数:30,代码来源:index.spec.ts


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