How to use the tape-promise.default function in tape-promise

To help you get started, we’ve selected a few tape-promise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / fabric-sdk-node / test / integration / network-e2e / instantiate-chaincode.js View on Github external
* Copyright 2017 IBM All Rights Reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

// This is an end-to-end test that focuses on exercising all parts of the fabric APIs
// in a happy-path scenario
'use strict';

const {Utils:utils} = require('fabric-common');
const logger = utils.getLogger('E2E instantiate-chaincode');
logger.level = 'debug';

const tape = require('tape');
const _test = require('tape-promise').default;
const test = _test(tape);

const e2eUtils = require('../e2e/e2eUtils.js');
const testUtil = require('../util.js');



test('\n\n***** Network End-to-end flow: instantiate chaincode *****\n\n', (t) => {
	e2eUtils.instantiateChaincodeWithId('org1', testUtil.NETWORK_END2END.chaincodeId, testUtil.NODE_CHAINCODE_PATH, 'v0', 'node', false, false, t)
		.then((result) => {
			if (result) {
				t.pass('Successfully instantiated chaincode on the channel');

				return testUtil.sleep(5000);
			} else {
				t.fail('Failed to instantiate chaincode ');
				t.end();
github hyperledger / fabric-sdk-node / test / integration / nodechaincode / query.js View on Github external
/**
 * Copyright 2017 IBM All Rights Reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

// This is an end-to-end test that focuses on exercising all parts of the fabric APIs
// in a happy-path scenario
'use strict';

const tape = require('tape');
const _test = require('tape-promise').default;
const test = _test(tape);
const e2eUtils = require('../e2e/e2eUtils.js');
const testUtils = require('../../unit/util');
const chaincodeId = testUtils.NODE_END2END.chaincodeId;

test('\n\n***** Node-Chaincode End-to-end flow: query chaincode *****\n\n', async (t) => {
	const fcn = 'query';
	const args = ['b'];
	let expectedResult = '300';
	const targets = [];  // empty array, meaning client will get the peers from the channel
	try {
		const result = await e2eUtils.queryChaincode('org2', 'v0', targets, fcn, args, expectedResult, chaincodeId, t, null, false);
		if (result) {
			t.pass('Successfully query chaincode on the channel');
		} else {
			t.fail('Failed to query chaincode ');
		}
github hyperledger / fabric-sdk-node / test / integration / e2e / instantiate-chaincode.js View on Github external
/**
 * Copyright 2017 IBM All Rights Reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

// This is an end-to-end test that focuses on exercising all parts of the fabric APIs
// in a happy-path scenario
'use strict';

const {Utils:utils} = require('fabric-common');
const logger = utils.getLogger('E2E instantiate-chaincode');

const tape = require('tape');
const _test = require('tape-promise').default;
const test = _test(tape);

const e2eUtils = require('./e2eUtils.js');
const testUtil = require('../util.js');

test('\n\n***** End-to-end flow: instantiate chaincode *****\n\n', async (t) => {
	try {
		const result = await e2eUtils.instantiateChaincode('org1', testUtil.CHAINCODE_PATH, 'v0', 'golang', false, false, t);
		if (result) {
			t.pass('Successfully instantiated chaincode on the channel');
			await testUtil.sleep(5000);
			logger.debug('Successfully slept 5s to wait for chaincode instantiate to be completed and committed in all peers');
		} else {
			t.fail('Failed to instantiate chaincode ');
		}
	} catch (err) {
		t.fail('Test failed due to reasons. ' + err.stack ? err.stack : err);
github LavaMoat / lavamoat-browserify / test / globalRef.js View on Github external
const test = require('tape-promise').default(require('tape'))
const clone = require('clone')

const {
  createBundleFromRequiresArray,
} = require('./util')

// const wrapModuleContent

test('globalRef - check default containment', async (t) => {
  const moduleContent = `
  let objCheckThis, objCheckSelf, objCheckGlobal, thisIsExports
  const isUndefined = {}

  try { objCheckThis = this.Object === Object } catch (_) { }
  try { objCheckSelf = self.Object === Object } catch (_) { }
  try { objCheckGlobal = global.Object === Object } catch (_) { }
github LavaMoat / lavamoat-browserify / test / globalWrites.js View on Github external
const test = require('tape-promise').default(require('tape'))

const { createBundleFromRequiresArray } = require('./util')

// here we are providing an endowments only to a module deep in a dep graph
test('globalWrites - deep endow', async (t) => {
  const entries = [
    {
      'id': '/one.js',
      'file': '/one.js',
      'source': "global.testResult = require('two');",
      'deps': { 'two': '/node_modules/two/index.js' },
      'entry': true
    },
    {
      'id': '/node_modules/two/index.js',
      'file': '/node_modules/two/index.js',
github LavaMoat / lavamoat-browserify / test / config.js View on Github external
const test = require('tape-promise').default(require('tape'))

const { createBundleFromRequiresArray } = require('./util')

// here we are providing an endowments only to a module deep in a dep graph
test('config - deep endow', async (t) => {
  const entries = [
    {
      'id': '/one.js',
      'file': '/one.js',
      'source': "require('two');",
      'deps': { 'two': '/node_modules/two/index.js' },
      'entry': true,
    },
    {
      'id': '/node_modules/two/index.js',
      'file': '/node_modules/two/index.js',
github LavaMoat / lavamoat-browserify / test / circularDeps.js View on Github external
const test = require('tape-promise').default(require('tape'))
const clone = require('clone')
const {
  createBundleFromRequiresArray,
  fnToCodeBlock,
} = require('./util')


test('circularDeps - multi-module circular deps dont inf loop', async (t) => {
  const files = [{
    // id must be full path
    id: './apple.js',
    file: './apple.js',
    deps: {
      'banana': './node_modules/banana/a.js',
    },
    source: fnToCodeBlock(function () {
github public-transport / hafas-client / test / e2e / saarfahrplan.js View on Github external
const validate = createValidate(cfg)

const assertValidPrice = (t, p) => {
	t.ok(p)
	if (p.amount !== null) {
		t.equal(typeof p.amount, 'number')
		t.ok(p.amount > 0)
	}
	if (p.hint !== null) {
		t.equal(typeof p.hint, 'string')
		t.ok(p.hint)
	}
}

const test = tapePromise(tape)
const client = createClient(saarfahrplanProfile, 'public-transport/hafas-client:test')

const saarbrueckenHbf = '8000323'
// This seems to be the bus/tram stop. 🙄
const hauptbahnhofSaarbruecken = '10600'
const saarlouisHbf = '8005247'
const metzVille = '8700019'
const saarbrueckenUhlandstr = '10609'

const thomasMannStr = {
	type: 'location',
	address: 'Neunkirchen, Thomas-Mann-Straße 1',
	latitude: 49.348307,
	longitude: 7.183613
}
github public-transport / hafas-client / test / e2e / bvg.js View on Github external
const validateDirection = (dir, name) => {
	if (!stations(dir, true, false)[0]) {
		console.error(name + `: station "${dir}" is unknown`)
	}
}

const validate = createValidate(cfg, {
	station: validateStation,
	line: validateLine,
	journeyLeg: validateJourneyLeg,
	departure: validateDeparture,
	movement: validateMovement
})

const test = tapePromise(tape)
const client = createClient(bvgProfile, 'public-transport/hafas-client:test')

const amrumerStr = '900000009101'
const spichernstr = '900000042101'
const bismarckstr = '900000024201'
const westhafen = '900000001201'
const wedding = '900000009104'
const württembergallee = '900000026153'
const tiergarten = '900000003103'
const jannowitzbrücke = '900000100004'

const hour = 60 * 60 * 1000

test('journeys – Spichernstr. to Bismarckstr.', async (t) => {
	const res = await client.journeys(spichernstr, bismarckstr, {
		results: 4,
github hyperledger / fabric-sdk-node / test / unit / identity-service.js View on Github external
/**
 * Copyright 2018 Hitachi America Ltd.  All Rights Reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

'use strict';

const tape = require('tape');
const _test = require('tape-promise').default;
const test = _test(tape);

const IdentityService = require('fabric-ca-client/lib/IdentityService.js');
const FabricCAServices = require('fabric-ca-client/lib/FabricCAClientImpl');
const FabricCAClient = FabricCAServices.FabricCAClient;
const User = require('../../fabric-ca-client/lib/User');

test('IdentityService: Test create() function', (t) => {
	const client = new FabricCAClient({ protocol: 'http', hostname: '127.0.0.1', port: 7054 });
	const identity = new IdentityService(client);

	t.throws(() => {
		identity.create();
	},
	/Missing required argument "req"/,
	'Must fail if missing request argument');

tape-promise

Promise/async support for tape.

MIT
Latest version published 6 years ago

Package Health Score

48 / 100
Full package analysis

Popular tape-promise functions