Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

async-test-util

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-test-util - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

dist/es/resolve-values.js

6

dist/es/index.js

@@ -11,2 +11,3 @@ import assertThrows from './assert-throws';

import randomNumber from './random-number';
import resolveValues from './resolve-values';

@@ -23,6 +24,7 @@ var AsyncTestUtil = {

randomString: randomString,
randomNumber: randomNumber
randomNumber: randomNumber,
resolveValues: resolveValues
};
export default AsyncTestUtil;
export { assertThrows, clone, deepEqual, waitResolveable, waitUntil, wait, waitForever, runForever, randomString, randomNumber };
export { assertThrows, clone, deepEqual, waitResolveable, waitUntil, wait, waitForever, runForever, randomString, randomNumber, resolveValues };

@@ -6,3 +6,3 @@ 'use strict';

});
exports.randomNumber = exports.randomString = exports.runForever = exports.waitForever = exports.wait = exports.waitUntil = exports.waitResolveable = exports.deepEqual = exports.clone = exports.assertThrows = undefined;
exports.resolveValues = exports.randomNumber = exports.randomString = exports.runForever = exports.waitForever = exports.wait = exports.waitUntil = exports.waitResolveable = exports.deepEqual = exports.clone = exports.assertThrows = undefined;

@@ -49,2 +49,6 @@ var _assertThrows = require('./assert-throws');

var _resolveValues = require('./resolve-values');
var _resolveValues2 = _interopRequireDefault(_resolveValues);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -62,3 +66,4 @@

randomString: _randomString2['default'],
randomNumber: _randomNumber2['default']
randomNumber: _randomNumber2['default'],
resolveValues: _resolveValues2['default']
};

@@ -75,2 +80,3 @@ exports['default'] = AsyncTestUtil;

exports.randomString = _randomString2['default'];
exports.randomNumber = _randomNumber2['default'];
exports.randomNumber = _randomNumber2['default'];
exports.resolveValues = _resolveValues2['default'];
{
"name": "async-test-util",
"version": "1.2.1",
"version": "1.3.0",
"description": "Util-functions that are be useful in async tests",

@@ -31,3 +31,3 @@ "main": "./dist/lib/index.js",

"babel-core": "6.26.0",
"babel-eslint": "8.0.2",
"babel-eslint": "8.2.0",
"babel-loader": "7.1.2",

@@ -50,5 +50,5 @@ "babel-plugin-transform-async-to-generator": "6.24.1",

"babel-preset-latest": "6.24.1",
"cross-env": "5.1.1",
"eslint": "4.11.0",
"mocha": "4.0.1",
"cross-env": "5.1.3",
"eslint": "4.16.0",
"mocha": "5.0.0",
"rimraf": "2.6.2"

@@ -55,0 +55,0 @@ },

@@ -149,2 +149,28 @@ # async-test-util

## resolveValues()
Recieves an object with promises as values. Returns ans object with the resolved promises as values.
Use this in test-setups to improve the test-speed by running everything in parallel.
```javascript
// instead of this
const database = await connectDatabase();
const user1 = await getUser();
const user2 = await getUser();
// do this
const {
database,
user1,
user2
} = await AsyncTestUtil.resolveValues({
database: connectDatabase();
user1: getUser();
user2: getUser();
});
```
## randomString()

@@ -151,0 +177,0 @@

@@ -54,3 +54,13 @@ /**

/**
* Recieves an object with promises as values. Returns ans object with the resolved promises as values.
* @param {Object} obj with promises as values
* @return {Promise<Object>} with resolved values
*/
type ResolveValuesParam = {
[key: string]: Promise<any> | any
}
export function resolveValues(obj: ResolveValuesParam): Promise<ResolveValuesParam>;
/**

@@ -57,0 +67,0 @@ * deep-clones the given object

@@ -11,2 +11,3 @@ import assertThrows from './assert-throws';

import randomNumber from './random-number';
import resolveValues from './resolve-values';

@@ -23,3 +24,4 @@ const AsyncTestUtil = {

randomString,
randomNumber
randomNumber,
resolveValues
};

@@ -38,3 +40,4 @@ export default AsyncTestUtil;

randomString,
randomNumber
randomNumber,
resolveValues
};

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc