當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript blue-tape類代碼示例

本文整理匯總了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;未經允許,請勿轉載。