const testCases = (name, CurrentAdapter, adapterMethod, cases) => { test(name, t => { cases.forEach(curCase => { t.test(curCase.name, co.wrap(function * (t) { let core = CurrentAdapter() let result, error try { result = core[adapterMethod](curCase.data) t.ok(isPromise(result), 'result to be Promise') result = yield result } catch (e) { error = e } if (!error) { if (curCase.error) { t.fail(`Expected error "${curCase.error}" but have result`) } if (isObject(curCase.result)) { t.deepEqual(result, curCase.result, 'action result is equal') } else { t.equal(result, curCase.result, 'action result is equal') } } else { if (curCase.error) { t.equal(error.message, curCase.error, `error message is "${curCase.error}"`) } else { throw error } } })) }) }) }
test('request flow', function (t) { t.test('before', function (t) { t.test('run a function before opening the request', function (t) { var req = popsicle.request(REMOTE_URL + '/echo'); t.plan(2); req.use(function (self, next) { t.equal(self, req); t.equal(typeof next, 'function'); return next(); }); return req; }); t.test('fail the request before starting', function (t) { var req = popsicle.request(REMOTE_URL + '/echo'); t.plan(1); req.use(function () { throw new Error('Hello world!'); }); return req .catch(function (err) { t.equal(err.message, 'Hello world!'); }); }); t.test('accept a promise to delay the request', function (t) { var req = popsicle.request({ url: REMOTE_URL + '/echo', method: 'POST', body: 'success' }); t.plan(2); req.use(function (self, next) { return new Promise(function (resolve) { setTimeout(function () { t.equal(self, req); resolve(); }, 10); }).then(next); }); return req .then(function (res) { t.equal(res.body, 'success'); }); }); }); test('after', function (t) { t.test('run after the response', function (t) { var req = popsicle.request(REMOTE_URL + '/echo'); t.plan(1); req.use(function (_, next) { return next() .then(function (res) { t.ok(res instanceof popsicle.Response); return res; }); }); return req; }); }); });
].forEach(({ leaves, expectedTree, }, idx) => { const tree = btree.buildFromLeaves(leaves) test((t) => { t.comment(`testing tree #${idx}`) t.deepEqual(tree, expectedTree, 'expected tree') t.end() }) test((t) => { t.deepEqual(btree.root(tree), expectedTree[0], 'root()') t.end() }) test((t) => { t.deepEqual(btree.leaves(tree), leaves, 'leaves()') t.end() }) })
test('Lunar.createActivator', function(t) { test('From a module', function(t) { let activator = createActivator.call({}, [moduleMock]); t.plan(7); t.equal(Object.getOwnPropertySymbols(activator.request)[0], moduleMock.actions.ONE); t.equal(typeof activator, 'object', 'Should return an object'); t.equal(activator.addMiddleware instanceof Function, true, `Should have method 'addMiddleware'`); t.equal(typeof activator.request, 'object', `Should have property 'request' as an Object`); t.equal(activator.request[moduleMock.actions.ONE] instanceof Function, true, `Should have methods on 'request' property`); t.equal(activator.request[moduleMock.actions.TWO] instanceof Function, true, `Should have methods on 'request' property`); t.equal(proxyMock.calledWithMatch([moduleMock]), true, `Should call 'proxy' with the right params`); t.end(); }); test('From a proxy', function(t) { let proxyInstanceMock = proxyMock.call({}, [moduleMock]); proxyInstanceMock.Proxy.doAction = sinon.spy((n) => n); let activator = createActivator.call({}, [proxyInstanceMock]); activator.request[proxyInstanceMock.Proxy.actions.ONE]('test-data'); t.plan(5); t.equal(typeof activator, 'object', 'Should return an object'); t.equal(typeof activator.request, 'object', `Should have property 'request' as an Object`); t.equal(activator.request[proxyInstanceMock.Proxy.actions.ONE] instanceof Function, true, `Should have methods on 'request' property`); t.equal(activator.request[proxyInstanceMock.Proxy.actions.TWO] instanceof Function, true, `Should have methods on 'request' property`); t.equal(proxyInstanceMock.Proxy.doAction.calledWith(proxyInstanceMock.Proxy.actions.ONE, 'test-data'), true, `Should call internal method 'doAction' with the right params`); t.end(); }); t.end(); });
.forEach(FILE => { test(FILE, {timeout: 1000}, t => { const {[FILE]:config=DEFAULT_CONFIG} = EXTRAS; let nodeArgs = ''; if (config.skip) { t.skip(); return t.end(); } // enable ECMAScript Module experimental support if (extname(FILE) === '.mjs') { nodeArgs += '--experimental-modules' } const {command='node', args:cmdArgs=''} = config; const cwd = join(__dirname, '..', FILE.split(posix.sep)[0]); const test_file = relative(cwd, FILE); const p = spawn(t, `${command} ${nodeArgs} ${test_file} ${cmdArgs}`, {cwd}); p.exitCode(config.exitCode, `exit code = ${config.exitCode}`); if (config.timeout) { t.timeoutAfter(config.timeout * 2) p.timeout(config.timeout); } if (config.stdin) { p.stdin.end(config.stdin); } if (config.stdout) { // runs win32 specific tests or default platforms p.stdout.match(config[`${platform}stdout`] || config.stdout); } config.stderr ? p.stderr.match(new RegExp(config.stderr)) : p.stderr.match(/^$/, 'stderr is empty'); return p.end(); }); });
test('normalizeResource: from baseUri string', t => { t.plan(1) const actual = normalizeResource(BASE) const expected = { defaultOperation: 'list', base: BASE, headers: {}, list: { method: 'GET', uri: '' }, create: { method: 'POST', uri: '' }, read: { method: 'GET', uri: ITEM_URI }, update: { method: 'PUT', uri: ITEM_URI }, patch: { method: 'PATCH', uri: ITEM_URI }, remove: { method: 'DELETE', uri: ITEM_URI }, uid: 'id', isResource: true, onFailure: noop, onSuccess: noop, onRequest: noop, } delete actual.getUri delete actual.getMethod delete actual.getBase t.deepEqual(actual, expected) t.end() })
} } } }; }; before('desc:', t => { t.pass('reducers: save-metric'); setup(); t.end(); }); test('saveMetric', t => { const actual = action.saveMetric(state, { type: Mocked.ConstantsActions.SAVE_METRIC, id: 1, name: 'John', chartType: 2 }), expect = nextState; t.deepEqual(actual, expect); t.end(); }); after('end', t => { t.pass('//--------------------------------------'); t.end(); });
import React from 'react' import test from 'blue-tape' import {shallow} from 'enzyme' import Hello from '../../app/components/hello' test('hello component to contain a Hello World message', t => { const helloComponent = shallow(<Hello />) t.ok(helloComponent.text().indexOf('Hello World') > -1) t.end() }) test('hello component button to toggle toggle-message', t => { const helloComponent = shallow(<Hello />) helloComponent.find('button').simulate('click') t.deepEqual(helloComponent.find('p').text(), 'Toggled: true') helloComponent.find('button').simulate('click') t.deepEqual(helloComponent.find('p').text(), 'Toggled: false') t.end() })
var methods = process.browser ? ['get', 'post', 'put', 'patch', 'delete'] : require('methods') var camelCase = require('camel-case') var test = require('blue-tape') var ExampleApi = require('../.tmp/example') test('custom resource', function (t) { var client = new ExampleApi() methods.forEach(function (verb) { var method = camelCase(verb) if (verb === 'connect' || verb === 'head') { return } t.test('#' + method + ' should work', function (t) { return client.resource('/status/{id}', { id: 200 })[method]() .then(function validateResponse (response) { t.equal(response.body, 'Success') t.equal(response.status, 200) }) }) }) })
'use strict' const test = require('blue-tape') const hapi = require('hapi') const boom = require('boom') const proxyquire = require('proxyquire') test('options', async function (t) { t.plan(2) const server = Server() const plugin = proxyquire('./', { raven: { config (dsn, options) { t.equal(dsn, 'dsn') t.deepEqual(options, { foo: 'bar' }) } } }) await register(server, plugin, { dsn: 'dsn', client: { foo: 'bar' } }) }) test('request-error', async function (t) { t.plan(11) const server = Server() const plugin = proxyquire('./', { raven: {
var METHODS_WITHOUT_BODY = ['connect', 'head', 'options']; var REMOTE_URL = 'http://localhost:' + process.env.PORT; var REMOTE_HTTPS_URL = 'https://localhost:' + process.env.HTTPS_PORT; var EXAMPLE_BODY = { username: '******', password: '******' }; var BOUNDARY_REGEXP = /^multipart\/form-data; boundary=([^;]+)/; var MULTIPART_SEP = '\r\n'; var supportsStatusText = parseFloat(process.version.replace(/^v/, '')) >= 0.12; test('should expose default functions', function (t) { t.equal(typeof popsicle, 'object'); t.equal(typeof popsicle.Request, 'function'); t.equal(typeof popsicle.Response, 'function'); t.equal(typeof popsicle.form, 'function'); t.equal(typeof popsicle.jar, 'function'); SHORTHAND_METHODS.forEach(function (method) { t.equal(typeof popsicle[method], 'function'); }); t.end(); }); test('throw an error when no options are provided', function (t) { t.throws(function () { return popsicle.request({}); }, /url must be a string/i); t.end(); }); test('create a popsicle#Request instance', function (t) { var req = popsicle.request('/'); t.ok(req instanceof popsicle.Request); req.set('Test', 'Test'); t.equal(req.rawHeaders.length, 2); req.remove('Test');
'use strict'; const test = require('blue-tape'); const keycloakAdminClient = require('../index'); const privates = require('../lib/private-map'); test('keycloakAdminClient should return a promise containing the client object', (t) => { const settings = { baseUrl: 'http://127.0.0.1:8080/auth', username: '******', password: '******', grant_type: 'password', client_id: 'admin-cli' }; const kca = keycloakAdminClient(settings); t.equal(kca instanceof Promise, true, 'should return a Promise'); return kca.then((client) => { t.equal(typeof client.baseUrl, 'string', 'client should contain a baseUrl String'); t.equal(client.baseUrl, settings.baseUrl, 'client should contain a baseUrl String'); }); }); test('keycloakAdminClient failed login, wrong user creds', (t) => { const settings = { baseUrl: 'http://127.0.0.1:8080/auth', username: '******', password: '******', grant_type: 'password', client_id: 'admin-cli'
accessToken: 'b4c0n73n7fu1', space: 'cfexampleapi' } if (process.env.API_INTEGRATION_TESTS) { params.host = '127.0.0.1:5000' params.insecure = true } const client = contentful.createClient(params) test('Gets space', t => { t.plan(3) return client.getSpace() .then(response => { t.ok(response.sys, 'sys') t.ok(response.name, 'name') t.ok(response.locales, 'locales') }) }) test('Gets content type', t => { t.plan(3) return client.getContentType('1t9IbcfdCk6m04uISSsaIK') .then(response => { t.ok(response.sys, 'sys') t.ok(response.name, 'name') t.ok(response.fields, 'fields') }) })
ok = yield store.setAsync('123', { cookie: { maxAge: undefined }, name: 'tj' }); t.equal(ok, 'OK', '#set() no maxAge ok'); data = yield store.allAsync(); t.deepEqual([{ id: '123', cookie: {}, name: 'tj' }], data, '#all() ok'); data = yield store.idsAsync(); t.deepEqual(['123'], data, '#ids() ok'); ok = yield store.destroyAsync('123'); t.equal(ok, 1, '#destroy() ok'); store.client.end(false); }); test('setup', redisSrv.connect); test('defaults', function (t) { var store = new RedisStore(); t.equal(store.prefix, 'sess:', 'defaults to sess:'); t.notOk(store.ttl, 'ttl not set'); t.notOk(store.disableTTL, 'disableTTL not set'); t.ok(store.client, 'creates client'); store.client.end(false); t.end(); }); test('basic', function (t) { t.throws(RedisStore, TypeError, 'constructor not callable as function'); var store = new RedisStore({ port: redisSrv.port });
import test from 'blue-tape'; import EurostatSource from '../lib/index.js'; import config from './test-config.js'; test('proper configuration', t => { t.equal(EurostatSource.props.name, require('../package.json').name); t.equal(EurostatSource.props.version, require('../package.json').version); t.end(); }); test('test map properties', async (t) => { const source = new EurostatSource(); const response = await source.getDataSet(config); }); test('test map properties', t => { const source = new EurostatSource(); const response = source.mapProperties(data); t.end(); });
import test from 'blue-tape' import schemaTests from './schemas/basic.json' import validateData from '../lib' test('Initialized hook', (assert) => { const hook = validateData({}) assert.equal(typeof hook, 'function', 'should be a function') assert.end() }) test('Executed hook with valid data', (assert) => { const executeHook = validateData(schemaTests.schema) const hook = { data: schemaTests.tests.valid.data, params: {} } executeHook(hook) assert.ok(hook.params.validated, 'should mark as valid data') assert.end() }) test('Executed hook with invalid data', (assert) => { const executeHook = validateData(schemaTests.schema) const hook = { data: schemaTests.tests.invalid.data, params: {} }
var test = require('blue-tape'); var statsClient = require('../lib/stats-client'); var GALAXY_ZOO_BARS_ID = '3'; var GALAXY_ZOO_BARS_WORKFLOW_ID = '1623'; if (process.env.NODE_ENV !== 'production') { console.log('We can currently only tests the stats client in production.'); process.exit(1); } test('We can get stats for a project', function(t) { return statsClient.query({ projectID: GALAXY_ZOO_BARS_ID, workflowID: GALAXY_ZOO_BARS_WORKFLOW_ID, type: 'classification', period: 'day' }).then(function(results) { return t.ok(Array.isArray(results), 'Should get an array back'); }); });
var test = require('blue-tape') var ExampleApi = require('../.tmp/example') test('annotations', function (t) { var client = new ExampleApi() t.test('method name annotation', function (t) { return client.getRoot() .then(function (res) { t.equal(res.body, 'Success') }) }) })
const symptomCreator = times => { return Promise.all(_.times(times, () => { const data = fixture.valid(); return symptomPoster(data) .then(unwrapJSON) })); }; const pop = data => data[0]; const singlesymptomCreator = () => symptomCreator(1).then(pop); test('POSTing a valid sprint should return 200', (t) => { const symptom = fixture.valid(); return symptomPoster(symptom) .then(assertOk(t)); }); test('GET /symptoms/:id should return 200', (t) => { return singlesymptomCreator() .then(body => fetch(url+'/symptoms/'+body.id)) .then(assertOk(t)); }); test('GET /symptoms should return 200', (t) => { return singlesymptomCreator() .then(() => fetch(url+'/symptoms')) .then(assertOk(t)); });
test('emit one value - one listener', function (t) { return suite('emit one value - one listener', function (s) { s.set('maxTime', setup.maxTime); s.set('minSamples', setup.minSamples); var subjects = setup.createInstancesOn(handle); var called = null; s.cycle(function (e) { t.false(e.target.error, e.target.name + ' runs without error'); t.equal(called, 1, 'handle called once'); called = null; }); s.burn('Theoretical max', function () { called = 0; handle('bar'); }); s.bench('EventEmitter', function () { called = 0; subjects.ee1.emit('foo', 'bar'); }); s.bench('EventEmitter2', function () { called = 0; subjects.ee2.emit('foo', 'bar'); }); s.bench('EventEmitter3', function () { called = 0; subjects.ee3.emit('foo', 'bar'); }); s.bench('dripEmitter', function () { called = 0; subjects.dripEmitter.emit('foo', 'bar'); }); s.bench('barracks', function () { called = 0; subjects.barracksDispatcher('foo', 'bar'); }); s.bench('push-stream', function () { called = 0; subjects.pushStream.push('bar'); }); s.bench('dripEmitterEnhanced', function () { called = 0; subjects.dripEmitterEnhanced.emit('foo', 'bar'); }); s.bench('d3-dispatch', function () { called = 0; subjects.dispatch.call('foo', null, 'bar'); }); s.bench('namespace-emitter', function () { called = 0; subjects.nsEmitter.emit('foo', 'bar'); }); s.bench('ReactiveProperty', function () { called = 0; subjects.rProperty('bar'); }); s.bench('observable', function () { called = 0; subjects.observableValue('bar'); }); s.bench('observ', function () { called = 0; subjects.observValue.set('bar'); }); s.bench('RXJS', function () { called = 0; subjects.subject.next('bar'); }); s.bench('JS-Signals', function () { called = 0; subjects.signal.dispatch('bar'); }); s.bench('MiniSignals', function () { called = 0; subjects.miniSignal.dispatch('bar'); }); s.bench('signal-emitter', function () { called = 0; subjects.signalEmitter.emit('bar'); }); s.bench('event-signal', function () { called = 0; subjects.eventSignal.emit('bar'); }); s.bench('signal-lite', function () { called = 0; subjects.signalLite.broadcast('bar'); }); s.bench('minivents', function () { called = 0; subjects.miniVent.emit('foo', 'bar'); }); function handle(a) { if (arguments.length === 1 && a === undefined) { return; } if (arguments.length === 0 || arguments.length > 2 || a !== 'bar') { throw new Error('invalid arguments ' + a); } called++; } }); });
import test from 'blue-tape'; import { mock } from './helpers'; import { sessionsUtils } from '../code/services/_sessions_utils'; test('onSingleSessionFetch extends session.streams with data.streams with lower case keys', t => { const data = { streams: { Key1: 1 } }; const session = { streams: { key2: 2 } }; const service = _sessionsUtils({}); service.onSingleSessionFetch(session, data, () => {}); t.deepEqual(data, {}); t.deepEqual(session, { loaded: true, streams: { key2: 2, key1: 1 } }); t.end(); }); test('onSingleSessionFetch adds loaded flag to session', t => { const session = {}; const service = _sessionsUtils({}); service.onSingleSessionFetch(session, { streams: {} }, () => {}); t.deepEqual(session, { loaded: true }); t.end(); }); test('onSingleSessionFetch calls the passed callback', t => { let called = false; const callback = () => { called = true; }
Agent.ready.then(()=>{ //Agent.register(); test('find Handling Robot', (t)=>{ return Agent.searchSkill('cfp-transport') .then((agents) => { t.assert( _.isArray(agents), 'agents must be an array'); t.assert( !_.isEmpty(agents), 'at least one agent should be in there'); t.assert( _.isObject(agents[0]), 'each element of the array must be an object'); //t.assert( HandlingRobot.id == agents[0].agent, 'agent must be the HandlingRobot agent id'); }); }); test.skip('check cfp-transport part 1', (t)=>{ return Agent.searchSkill('cfp-transport') .then((agents) => { return agents[0]; }) .then((agent) => { return Agent.CAcfp(agent.agent, 'cfp-transport', '') .then((reply) => { t.assert(_.isNumber(reply.price), 'reply must have a price'); t.assert((reply.price > 0 && reply.price < 1), 'price must be between 0 and 1'); t.equal(reply.agent, agent.agent, 'agent must be part of reply'); return reply; }); }); }); const mockEdge = { from: { agent: '', position: 40 }, to: { agent: '', position: 50 } }; test('check cfp-transport part 1', (t)=>{ return Agent.searchSkill('cfp-transport') .then((agents) => { return agents[0]; }) .then((agent) => { return Agent.CAcfp(agent.agent, 'cfp-transport', '') .then((reply) => { t.assert(_.isNumber(reply.price), 'reply must have a price'); t.assert((reply.price > 0 && reply.price < 1), 'price must be between 0 and 1'); t.equal(reply.agent, agent.agent, 'agent must be part of reply'); return reply; }); }) .then((reply) => { return Agent.CAcfpAcceptProposal(reply.agent, 'cfp-transport', mockEdge); }) .then((reply) => { console.log('it worked :-) ', reply); let task = reply.informDone; t.deepEqual(task.task.from, mockEdge.from, 'compare from'); //TODO why doesnt the test end? return Promise.resolve(); }); }); test('killAll', (t)=>{ t.pass('emit SIGINT signal which kills the required HandlingRobot with a delay of 500ms'); process.emit('SIGINT'); setTimeout(process.exit, 500); t.end(); }); });
test('Adding to an order', (t) => { const lineItem = { previews: '123/MAR', publisher: 'foo', title: 'bar', price: 0, quantity: 1, comment: '' }; const store = mockStore({ issues: { data: [{ previewsCode: '123/MAR', publisher: 'foo', title: 'bar', price: 0 }] }, order: { items: [] } }); const expectedActions = [ { type: 'ADD_TO_ORDER', payload: lineItem } ]; store.dispatch(Actions.addToOrder(lineItem.previews)); t.deepEqual(store.getActions(), expectedActions); t.end(); });
import test from 'blue-tape'; import deduce from '../src/index.js'; test('should contain state', async (t) => { const storeA = deduce(); const storeB = deduce({ foo: 'bar' }); t.deepEqual(storeA.state, {}); t.deepEqual(storeB.state, { foo: 'bar' }); }); test('should modify state', async (t) => { const store = deduce(1, { increment: (x) => x + 1, }); t.equal(store.state, 1); store.increment(); t.equal(store.state, 2); });
'use strict'; const test = require('blue-tape'); const admin = require('./utils/realm'); const TestVector = require('./utils/helper').TestVector; const page = require('./utils/webdriver').newPage; const NodeApp = require('./fixtures/node-console/index').NodeApp; const realmManager = admin.createRealm(); const app = new NodeApp(); test('setup', t => { return realmManager.then(() => { return admin.createClient(app.publicClient()) .then((installation) => { return app.build(installation); }); }); }); // test('setup', t => { // return client = realmManager.then((realm) => { // return admin.createClient(app.publicClient()); // }); // }); test('Should be able to access public page', t => { t.plan(1); page.get(app.port);
var test = require('blue-tape'); var config = require('./../config.js'); var MI5REST = require('./../rest'); var mi5Rest = new MI5REST(config.rest.host, config.auth.user, config.auth.password); // JobBoard test('Test Jobboard ===============================================================', function(t){ t.plan(1); t.pass('test-jobboard.js - file loaded') }); test('Jobboard - getOrdersSince', function(t){ return mi5Rest.getOrdersSince() .then(function(result){ console.log(result); }); }); test('Jobboard - getOrdersUpdateSince', function(t){ return mi5Rest.getOrdersUpdatedSince(300) .then(function(result){ console.log(result); }); }); // Experimental - makes orders appear multiple times test.skip('Jobboard Hack', function(t){ return mi5Rest.reloadJobboardHack() .then(function(result){
import test from 'blue-tape' import tk from 'timekeeper' import * as date from '../src/date' test('now', (t) => { tk.freeze() const currentDate = new Date() t.assert(Object.isFrozen(date.now()), 'returns a frozen object') t.deepEqual(date.now().toString(), currentDate.toString(), 'generates current date') tk.reset() t.end() }) test('isoDate', (t) => { const expectedDate = '2015-09-03' const today = new Date(`${expectedDate}T00:00:00+0200`) t.equal(date.isoDate(today), expectedDate, 'generates ISO date in a correct timezone') t.end() }) test('weekRange', (t) => { const today = new Date('2015-09-03') const start = new Date('2015-08-31T00:00:00+0200').toString() const end = new Date('2015-09-06T23:59:59+0200').toString() const expectedRange = [start, end] const actualRange = date.weekRange(today).map(d => d.toString()) t.deepEqual(actualRange, expectedRange)
test('prune', function (t) { t.test('remove extraneous typings', function (t) { var FIXTURE_DIR = path_1.join(__dirname, '__test__/prune-extraneous'); return generateTestDefinitions(FIXTURE_DIR) .then(function () { return prune_1.prune({ cwd: FIXTURE_DIR }); }) .then(function () { return Promise.all([ fs_1.readFile(path_1.join(FIXTURE_DIR, BROWSER_INDEX), 'utf8'), fs_1.readFile(path_1.join(FIXTURE_DIR, MAIN_INDEX), 'utf8'), fs_1.isFile(path_1.join(FIXTURE_DIR, BROWSER_GLOBAL_TYPINGS)), fs_1.isFile(path_1.join(FIXTURE_DIR, BROWSER_TYPINGS)), fs_1.isFile(path_1.join(FIXTURE_DIR, MAIN_GLOBAL_TYPINGS)), fs_1.isFile(path_1.join(FIXTURE_DIR, MAIN_TYPINGS)) ]); }) .then(function (_a) { var browserDts = _a[0], mainDts = _a[1], hasBrowserGlobalDefinition = _a[2], hasBrowserDefinition = _a[3], hasMainGlobalDefinition = _a[4], hasMainDefinition = _a[5]; t.equal(browserDts, [ "/// <reference path=\"globals/test/index.d.ts\" />", "/// <reference path=\"modules/test/index.d.ts\" />", "" ].join('\n')); t.equal(mainDts, [ "/// <reference path=\"globals/test/index.d.ts\" />", "/// <reference path=\"modules/test/index.d.ts\" />", "" ].join('\n')); t.equal(hasBrowserGlobalDefinition, true); t.equal(hasBrowserDefinition, true); t.equal(hasMainGlobalDefinition, true); t.equal(hasMainDefinition, true); }); }); t.test('remove all dev dependencies', function (t) { var FIXTURE_DIR = path_1.join(__dirname, '__test__/prune-production'); return generateTestDefinitions(FIXTURE_DIR) .then(function () { return prune_1.prune({ cwd: FIXTURE_DIR, production: true }); }) .then(function () { return Promise.all([ fs_1.readFile(path_1.join(FIXTURE_DIR, BROWSER_INDEX), 'utf8'), fs_1.readFile(path_1.join(FIXTURE_DIR, MAIN_INDEX), 'utf8'), fs_1.isFile(path_1.join(FIXTURE_DIR, BROWSER_GLOBAL_TYPINGS)), fs_1.isFile(path_1.join(FIXTURE_DIR, BROWSER_TYPINGS)), fs_1.isFile(path_1.join(FIXTURE_DIR, MAIN_GLOBAL_TYPINGS)), fs_1.isFile(path_1.join(FIXTURE_DIR, MAIN_TYPINGS)) ]); }) .then(function (_a) { var browserDts = _a[0], mainDts = _a[1], hasBrowserGlobalDefinition = _a[2], hasBrowserDefinition = _a[3], hasMainGlobalDefinition = _a[4], hasMainDefinition = _a[5]; t.equal(browserDts, "\n"); t.equal(mainDts, "\n"); t.equal(hasBrowserGlobalDefinition, false); t.equal(hasBrowserDefinition, false); t.equal(hasMainGlobalDefinition, false); t.equal(hasMainDefinition, false); }); }); });
"use strict"; var test = require("blue-tape"); var typings_1 = require("./typings"); var pkg = require('../package.json'); test('typings', function (t) { t.test('version', function (t) { t.equal(typings_1.VERSION, pkg.version); t.end(); }); }); //# sourceMappingURL=typings.spec.js.map
] }; test('should modify ast nodes', { objectPrintDepth: 20 }, async t => { const actual = await walk(ast, async node => { const { description, name, type } = node; t.equal(typeof type, 'string'); // Should drop nodes if (name === 'html') { return; } // Should not modify nodes if (!description) { return node; } // Should modify nodes return { ...node, description: description.toUpperCase(), foo: 'bar' }; }); t.notEqual(actual, ast); t.deepEqual(actual, expected); });