本文整理汇总了TypeScript中blue-tape类的典型用法代码示例。如果您正苦于以下问题:TypeScript blue-tape类的具体用法?TypeScript blue-tape怎么用?TypeScript blue-tape使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了blue-tape类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
import * as d from 'doctrine';
import * as test from 'blue-tape';
test('parse no options', (t: test.Test) => {
let res = d.parse('');
t.plan(2);
t.equal(res.description, '');
t.equal(res.tags.length, 0);
});
test('parse empty options', (t: test.Test) => {
let res = d.parse('', {});
t.equal(res.description, '');
t.equal(res.tags.length, 0);
t.end();
});
test('parse all options', (t: test.Test) => {
let res = d.parse('/* this is a test\n * @param {number} bees the number of bees\n */', {
unwrap: true,
tags: null,
recoverable: true,
sloppy: true,
lineNumbers: true
});
t.plan(10);
t.equal(res.description, 'this is a test');
t.equal(res.tags.length, 1);
t.equal(res.tags[0].title, 'param');
t.equal(res.tags[0].name, 'bees');
t.equal(res.tags[0].description, 'the number of bees');
开发者ID:kazimuth,项目名称:typed-doctrine,代码行数:31,代码来源:test.ts
示例2: Tracker
import * as test from 'blue-tape';
import {Tracker} from 'are-we-there-yet';
let name = 'test';
test('initialization', (t) => {
t.plan(1);
let simple = new Tracker(name);
t.is(simple.completed(), 0, 'Nothing todo is 0 completion');
});
开发者ID:demurgos,项目名称:typed-are-we-there-yet,代码行数:11,代码来源:test.ts
示例3:
import * as test from "blue-tape";
// import {inject} from "webpack-partial";
test("inject", (t) => {
t.end();
});
开发者ID:BloodyEnterprise,项目名称:typings-webpack-partial,代码行数:6,代码来源:inject.spec.ts
示例4:
import * as test from 'blue-tape';
import * as login from 'facebook-chat-api';
test('login', (t) => {
t.plan(1);
t.equal(typeof login, 'function');
});
开发者ID:insa-frif,项目名称:typed-facebook-chat-api,代码行数:7,代码来源:test.ts
示例5:
import * as test from 'blue-tape';
import * as request from 'request';
test('request', (t) => {
t.plan(1);
t.equal(typeof request, 'function');
});
开发者ID:corlobepy,项目名称:typed-request,代码行数:8,代码来源:test.ts
示例6:
import * as test from 'blue-tape';
import * as redis from 'redis';
test('test', (t) => {
t.plan(2);
t.assert(typeof redis.debug_mode === 'boolean', 'debug_mode');
t.assert(typeof redis.createClient === 'function', 'createClient');
});
开发者ID:blakeembrey,项目名称:typed-redis,代码行数:8,代码来源:test.ts
示例7:
import * as test from "blue-tape";
// import {partial} from "webpack-partial";
test("partial", (t) => {
t.end();
});
开发者ID:BloodyEnterprise,项目名称:typings-webpack-partial,代码行数:6,代码来源:partial.spec.ts
示例8: async
import * as test from 'blue-tape';
import compose from '../src/compose';
import Site from '../src/site';
import ContentItemBuilder from '../src/content-item-builder';
test('compose', (t) => {
t.test('identity function', async (st) => {
const inSite = new Site([]);
const outSite = await compose((site) => site, (site) => site)(inSite);
st.equals(outSite, inSite, 'identity function composes correctly');
});
t.test('functions apply in order', async (st) => {
const contentItem = new ContentItemBuilder(false, '').build();
const site1 = new Site([]);
const site2 = new Site([contentItem]);
const outSite = await compose((site) => site1, (site) => site2)(site1);
st.equals(outSite, site2, 'second function applies second');
});
});
开发者ID:mjwbenton,项目名称:staircase-generator,代码行数:22,代码来源:compose.ts
示例9: Site
test('Site', (t) => {
t.test('constructor', (st) => {
const site = new Site([]);
st.deepEquals(site.meta, {}, 'meta defaults to empty object');
st.end();
});
t.test('#withMeta/#getMeta', (st) => {
const key = 'key';
const value = 'value';
const site = new Site([]);
const newSite = site.withMeta(key, value);
st.equals(newSite.meta[key], value);
st.assert(site.meta[key] === undefined);
st.end();
});
t.test('#mapWithFilters', (st) => {
{
const site = new Site([ci(1), ci(2), ci(3), ci(4)])
.mapWithFilters([],
(x: ContentItem) => ci(parseInt(x.content) * 2));
st.deepEquals(site.items, [ci(2), ci(4), ci(6), ci(8)],
'map applies to all items with no filters');
}
{
const site = new Site([ci(1), ci(2), ci(3), ci(4)])
.mapWithFilters([
(x: ContentItem) => intContent(x) < 2,
(x: ContentItem) => intContent(x) > 3
], (x: ContentItem) => ci(intContent(x) * 2));
st.deepEquals(site.items, [ci(1), ci(4), ci(6), ci(4)],
'map only applies to unfiltered items');
}
st.end();
});
t.test('#forEachWithFilters', (st) => {
const ci3 = cid(3, [ci(1), ci(2)]);
const ci1 = ci3.children.getNthContentItem(0);
const ci2 = ci3.children.getNthContentItem(1);
const ci4 = ci(4);
{
const result: ContentItem[] = [];
new Site([ci3, ci4]).forEachWithFilters([], (x: ContentItem) => {
result.push(x);
});
st.deepEquals(result, [ci1, ci2, ci3, ci4],
'for each applies to all items with no filters');
}
{
const result: ContentItem[] = [];
new Site([ci3, ci4]).forEachWithFilters(
[(x: ContentItem) => intContent(x) < 2, (x: ContentItem) => intContent(x) > 3],
(x: ContentItem) => {
result.push(x);
});
st.deepEquals(result, [ci2, ci3],
'for each applies to unfiltered items with filters');
}
st.end();
});
t.test('#forEachWithFiltersTopLevel', (st) => {
{
const input = [ci(1), ci(2), cid(3, [ci(4)])];
const result: ContentItem[] = [];
new Site(input).forEachWithFiltersTopLevel([], (x: ContentItem) => {
result.push(x);
});
st.deepEquals(result, input,
'for each applies to all items with no filters');
}
{
const result: ContentItem[] = [];
new Site([ci(1), ci(2), ci(3), ci(4)]).forEachWithFiltersTopLevel(
[(x) => intContent(x) < 2, (x) => intContent(x) > 3], (x: ContentItem) => {
result.push(x);
});
st.deepEquals(result, [ci(2), ci(3)],
'for each applies to unfiltered items with filters');
}
st.end();
});
t.test('#writeToPath', async (st) => {
const site = new Site([ci(1), cid(4, [ci(2), ci(3)])]);
await site.writeToPath('/test');
st.assert(writeFileStub.calledWith('/test/1', '1'), 'file 1');
st.assert(writeFileStub.calledWith('/test/4/2', '2'), 'file 2');
st.assert(writeFileStub.calledWith('/test/4/3', '3'), 'file 3');
});
t.test('readSiteFromPath', async (st) => {
const path = '/a';
const files = ['1'];
readdirStub.withArgs(path).returns(Promise.resolve(files));
lstatStub.returns(Promise.resolve({
isDirectory() {
//.........这里部分代码省略.........
开发者ID:mjwbenton,项目名称:staircase-generator,代码行数:101,代码来源:site.ts
示例10: Stream
'\u001b[0m'
];
let result = [];
let stream: any = new Stream();
stream.write = function (message) {
result.push(message);
};
stream.writable = true;
stream.isTTY = true;
stream.end = function () {};
npmlog.stream = stream;
npmlog.heading = 'npm';
test('request', (t) => {
t.plan(1);
npmlog.level = 'silly';
npmlog.silly('silly prefix', 'x = %j', {foo:{bar:'baz'}});
npmlog.verbose('verbose prefix', 'x = %j', {foo:{bar:'baz'}});
npmlog.info('info prefix', 'x = %j', {foo:{bar:'baz'}});
npmlog.http('http prefix', 'x = %j', {foo:{bar:'baz'}});
npmlog.warn('warn prefix', 'x = %j', {foo:{bar:'baz'}});
npmlog.error('error prefix', 'x = %j', {foo:{bar:'baz'}});
npmlog.silent('silent prefix', 'x = %j', {foo:{bar:'baz'}});
t.deepEqual(result.join('').trim(), resultExpect.join('').trim(), 'result');
});
开发者ID:demurgos,项目名称:typed-npmlog,代码行数:30,代码来源:test.ts
注:本文中的blue-tape类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论