fix(core): update
This commit is contained in:
parent
1fbc9b6001
commit
14ab9ee908
35
package-lock.json
generated
35
package-lock.json
generated
@ -8,6 +8,11 @@
|
|||||||
"name": "@pushrocks/smartexpect",
|
"name": "@pushrocks/smartexpect",
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
|
"@pushrocks/smartpromise": "^3.1.6",
|
||||||
|
"chai": "^4.3.4"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.25",
|
"@gitzone/tsbuild": "^2.1.25",
|
||||||
"@gitzone/tsbundle": "^1.0.78",
|
"@gitzone/tsbundle": "^1.0.78",
|
||||||
@ -2228,7 +2233,6 @@
|
|||||||
"version": "2.0.13",
|
"version": "2.0.13",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdelay/-/smartdelay-2.0.13.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdelay/-/smartdelay-2.0.13.tgz",
|
||||||
"integrity": "sha512-s6Wh0BHWMfZ5VYONQwpxOYX1JeC9RKA0O9TxEzfZ6FCw2oNQb2QUPCixT9rsceKwva4+atKRw/RfU+Z7aJDmsA==",
|
"integrity": "sha512-s6Wh0BHWMfZ5VYONQwpxOYX1JeC9RKA0O9TxEzfZ6FCw2oNQb2QUPCixT9rsceKwva4+atKRw/RfU+Z7aJDmsA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartpromise": "^3.0.6"
|
"@pushrocks/smartpromise": "^3.0.6"
|
||||||
@ -2552,7 +2556,6 @@
|
|||||||
"version": "3.1.6",
|
"version": "3.1.6",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.1.6.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.1.6.tgz",
|
||||||
"integrity": "sha512-v+RyVpspzYuBcV/aWXqwC03TWYeFLj7aWMG3IBDFmH2ssgug+82KLW/gw2WB2aVOEvmSkfI9OVvOQz2OsLbYlA==",
|
"integrity": "sha512-v+RyVpspzYuBcV/aWXqwC03TWYeFLj7aWMG3IBDFmH2ssgug+82KLW/gw2WB2aVOEvmSkfI9OVvOQz2OsLbYlA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@pushrocks/smartpuppeteer": {
|
"node_modules/@pushrocks/smartpuppeteer": {
|
||||||
@ -3791,7 +3794,6 @@
|
|||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/assertion-error/-/assertion-error-1.1.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/assertion-error/-/assertion-error-1.1.0.tgz",
|
||||||
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
|
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "*"
|
"node": "*"
|
||||||
@ -4650,7 +4652,6 @@
|
|||||||
"version": "4.3.4",
|
"version": "4.3.4",
|
||||||
"resolved": "https://verdaccio.lossless.one/chai/-/chai-4.3.4.tgz",
|
"resolved": "https://verdaccio.lossless.one/chai/-/chai-4.3.4.tgz",
|
||||||
"integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==",
|
"integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"assertion-error": "^1.1.0",
|
"assertion-error": "^1.1.0",
|
||||||
@ -4706,7 +4707,6 @@
|
|||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://verdaccio.lossless.one/check-error/-/check-error-1.0.2.tgz",
|
"resolved": "https://verdaccio.lossless.one/check-error/-/check-error-1.0.2.tgz",
|
||||||
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
|
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "*"
|
"node": "*"
|
||||||
@ -6011,7 +6011,6 @@
|
|||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://verdaccio.lossless.one/deep-eql/-/deep-eql-3.0.1.tgz",
|
"resolved": "https://verdaccio.lossless.one/deep-eql/-/deep-eql-3.0.1.tgz",
|
||||||
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
|
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"type-detect": "^4.0.0"
|
"type-detect": "^4.0.0"
|
||||||
@ -7426,7 +7425,6 @@
|
|||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/get-func-name/-/get-func-name-2.0.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/get-func-name/-/get-func-name-2.0.0.tgz",
|
||||||
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
|
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "*"
|
"node": "*"
|
||||||
@ -11045,7 +11043,6 @@
|
|||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://verdaccio.lossless.one/pathval/-/pathval-1.1.1.tgz",
|
"resolved": "https://verdaccio.lossless.one/pathval/-/pathval-1.1.1.tgz",
|
||||||
"integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==",
|
"integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "*"
|
"node": "*"
|
||||||
@ -14797,7 +14794,6 @@
|
|||||||
"version": "4.0.8",
|
"version": "4.0.8",
|
||||||
"resolved": "https://verdaccio.lossless.one/type-detect/-/type-detect-4.0.8.tgz",
|
"resolved": "https://verdaccio.lossless.one/type-detect/-/type-detect-4.0.8.tgz",
|
||||||
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
|
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
@ -17245,7 +17241,6 @@
|
|||||||
"version": "2.0.13",
|
"version": "2.0.13",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdelay/-/smartdelay-2.0.13.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdelay/-/smartdelay-2.0.13.tgz",
|
||||||
"integrity": "sha512-s6Wh0BHWMfZ5VYONQwpxOYX1JeC9RKA0O9TxEzfZ6FCw2oNQb2QUPCixT9rsceKwva4+atKRw/RfU+Z7aJDmsA==",
|
"integrity": "sha512-s6Wh0BHWMfZ5VYONQwpxOYX1JeC9RKA0O9TxEzfZ6FCw2oNQb2QUPCixT9rsceKwva4+atKRw/RfU+Z7aJDmsA==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/smartpromise": "^3.0.6"
|
"@pushrocks/smartpromise": "^3.0.6"
|
||||||
}
|
}
|
||||||
@ -17548,8 +17543,7 @@
|
|||||||
"@pushrocks/smartpromise": {
|
"@pushrocks/smartpromise": {
|
||||||
"version": "3.1.6",
|
"version": "3.1.6",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.1.6.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.1.6.tgz",
|
||||||
"integrity": "sha512-v+RyVpspzYuBcV/aWXqwC03TWYeFLj7aWMG3IBDFmH2ssgug+82KLW/gw2WB2aVOEvmSkfI9OVvOQz2OsLbYlA==",
|
"integrity": "sha512-v+RyVpspzYuBcV/aWXqwC03TWYeFLj7aWMG3IBDFmH2ssgug+82KLW/gw2WB2aVOEvmSkfI9OVvOQz2OsLbYlA=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"@pushrocks/smartpuppeteer": {
|
"@pushrocks/smartpuppeteer": {
|
||||||
"version": "1.0.36",
|
"version": "1.0.36",
|
||||||
@ -18568,8 +18562,7 @@
|
|||||||
"assertion-error": {
|
"assertion-error": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/assertion-error/-/assertion-error-1.1.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/assertion-error/-/assertion-error-1.1.0.tgz",
|
||||||
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
|
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"assign-symbols": {
|
"assign-symbols": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@ -19217,7 +19210,6 @@
|
|||||||
"version": "4.3.4",
|
"version": "4.3.4",
|
||||||
"resolved": "https://verdaccio.lossless.one/chai/-/chai-4.3.4.tgz",
|
"resolved": "https://verdaccio.lossless.one/chai/-/chai-4.3.4.tgz",
|
||||||
"integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==",
|
"integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"assertion-error": "^1.1.0",
|
"assertion-error": "^1.1.0",
|
||||||
"check-error": "^1.0.2",
|
"check-error": "^1.0.2",
|
||||||
@ -19257,8 +19249,7 @@
|
|||||||
"check-error": {
|
"check-error": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://verdaccio.lossless.one/check-error/-/check-error-1.0.2.tgz",
|
"resolved": "https://verdaccio.lossless.one/check-error/-/check-error-1.0.2.tgz",
|
||||||
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
|
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"chokidar": {
|
"chokidar": {
|
||||||
"version": "2.1.8",
|
"version": "2.1.8",
|
||||||
@ -20246,7 +20237,6 @@
|
|||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://verdaccio.lossless.one/deep-eql/-/deep-eql-3.0.1.tgz",
|
"resolved": "https://verdaccio.lossless.one/deep-eql/-/deep-eql-3.0.1.tgz",
|
||||||
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
|
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"type-detect": "^4.0.0"
|
"type-detect": "^4.0.0"
|
||||||
}
|
}
|
||||||
@ -21294,8 +21284,7 @@
|
|||||||
"get-func-name": {
|
"get-func-name": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/get-func-name/-/get-func-name-2.0.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/get-func-name/-/get-func-name-2.0.0.tgz",
|
||||||
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
|
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"get-intrinsic": {
|
"get-intrinsic": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
@ -23938,8 +23927,7 @@
|
|||||||
"pathval": {
|
"pathval": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://verdaccio.lossless.one/pathval/-/pathval-1.1.1.tgz",
|
"resolved": "https://verdaccio.lossless.one/pathval/-/pathval-1.1.1.tgz",
|
||||||
"integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==",
|
"integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"pbkdf2": {
|
"pbkdf2": {
|
||||||
"version": "3.1.2",
|
"version": "3.1.2",
|
||||||
@ -26704,8 +26692,7 @@
|
|||||||
"type-detect": {
|
"type-detect": {
|
||||||
"version": "4.0.8",
|
"version": "4.0.8",
|
||||||
"resolved": "https://verdaccio.lossless.one/type-detect/-/type-detect-4.0.8.tgz",
|
"resolved": "https://verdaccio.lossless.one/type-detect/-/type-detect-4.0.8.tgz",
|
||||||
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
|
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"type-fest": {
|
"type-fest": {
|
||||||
"version": "2.10.0",
|
"version": "2.10.0",
|
||||||
|
@ -20,7 +20,11 @@
|
|||||||
"tslint": "^6.1.3",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
"dependencies": {
|
||||||
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
|
"@pushrocks/smartpromise": "^3.1.6",
|
||||||
|
"chai": "^4.3.4"
|
||||||
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
],
|
],
|
||||||
|
18
test/test.ts
18
test/test.ts
@ -1,8 +1,20 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { tap } from '@pushrocks/tapbundle';
|
||||||
import * as smartexpect from '../ts/index';
|
import * as smartexpect from '../ts/index';
|
||||||
|
|
||||||
tap.test('first test', async () => {
|
tap.test('sync tests', async () => {
|
||||||
console.log(smartexpect.standardExport);
|
smartexpect.expect('hello').toBeTypeofString();
|
||||||
|
smartexpect.expect(1).not.toBeTypeofString();
|
||||||
|
smartexpect.expect(true).toBeTypeofBoolean();
|
||||||
|
smartexpect.expect(true).not.toBeTypeofNumber();
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('async tests', async (toolsArg) => {
|
||||||
|
const deferred = toolsArg.defer();
|
||||||
|
toolsArg.delayFor(4000).then(() => {
|
||||||
|
deferred.resolve('hello');
|
||||||
|
});
|
||||||
|
await smartexpect.expectAsync(deferred.promise).timeout(5000).toBeTypeofString();
|
||||||
|
await smartexpect.expectAsync(deferred.promise).not.toBeTypeofBoolean();
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
12
ts/index.ts
12
ts/index.ts
@ -1,3 +1,13 @@
|
|||||||
import * as plugins from './smartexpect.plugins';
|
import * as plugins from './smartexpect.plugins';
|
||||||
|
|
||||||
export let standardExport = 'Hi there! :) This is an exported string';
|
import { Assertion } from './smartexpect.classes.assertion';
|
||||||
|
|
||||||
|
export const expect = (baseArg: any) => {
|
||||||
|
const assertion = new Assertion(baseArg, 'sync');
|
||||||
|
return assertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const expectAsync = (baseArg: any) => {
|
||||||
|
const assertion = new Assertion(baseArg, 'async');
|
||||||
|
return assertion;
|
||||||
|
}
|
94
ts/smartexpect.classes.assertion.ts
Normal file
94
ts/smartexpect.classes.assertion.ts
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
import * as plugins from './smartexpect.plugins';
|
||||||
|
|
||||||
|
export type TExecutionType = 'sync' | 'async';
|
||||||
|
|
||||||
|
export class Assertion {
|
||||||
|
executionMode: TExecutionType;
|
||||||
|
baseReference: any;
|
||||||
|
private notSetting = false;
|
||||||
|
private timeoutSetting = 0;
|
||||||
|
constructor(baseReferenceArg: any, executionModeArg: TExecutionType) {
|
||||||
|
this.baseReference = baseReferenceArg;
|
||||||
|
this.executionMode = executionModeArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get not() {
|
||||||
|
this.notSetting = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public timeout(millisArg: number) {
|
||||||
|
this.timeoutSetting = millisArg;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private runCheck(checkFunction: () => any) {
|
||||||
|
const runDirectOrNegated = (checkFunction: () => any) => {
|
||||||
|
if (!this.notSetting) {
|
||||||
|
return checkFunction();
|
||||||
|
} else {
|
||||||
|
let isOk = false;
|
||||||
|
try {
|
||||||
|
runDirectOrNegated(checkFunction())
|
||||||
|
} catch (e) {
|
||||||
|
isOk = true;
|
||||||
|
}
|
||||||
|
if (!isOk) {
|
||||||
|
throw new Error('Negated assertion is not ok!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.executionMode === 'async') {
|
||||||
|
const done = plugins.smartpromise.defer();
|
||||||
|
if (!(this.baseReference instanceof Promise)) {
|
||||||
|
done.reject(new Error(`${this.baseReference} is not of type promise.`));
|
||||||
|
} else {
|
||||||
|
if (this.timeoutSetting) {
|
||||||
|
plugins.smartdelay.delayFor(this.timeoutSetting).then(() => {
|
||||||
|
if (done.status === 'pending') {
|
||||||
|
done.reject(new Error(`${this.baseReference} timed out at ${this.timeoutSetting}!`))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.baseReference.then(promiseResultArg => {
|
||||||
|
this.baseReference = promiseResultArg;
|
||||||
|
done.resolve(runDirectOrNegated(checkFunction));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return done.promise;
|
||||||
|
} else {
|
||||||
|
return runDirectOrNegated(checkFunction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public toBeTypeofString() {
|
||||||
|
return this.runCheck(() => {
|
||||||
|
if (typeof this.baseReference !== 'string') {
|
||||||
|
throw new Error(
|
||||||
|
`Assertion failed: ${this.baseReference} is not of type string, but typeof ${typeof this.baseReference}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public toBeTypeofNumber() {
|
||||||
|
return this.runCheck(() => {
|
||||||
|
if (typeof this.baseReference !== 'number') {
|
||||||
|
throw new Error(
|
||||||
|
`Assertion failed: ${this.baseReference} is not of type string, but typeof ${typeof this.baseReference}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public toBeTypeofBoolean() {
|
||||||
|
return this.runCheck(() => {
|
||||||
|
if (typeof this.baseReference !== 'boolean') {
|
||||||
|
throw new Error(
|
||||||
|
`Assertion failed: ${this.baseReference} is not of type string, but typeof ${typeof this.baseReference}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -1,2 +1,14 @@
|
|||||||
const removeme = {};
|
import * as smartdelay from '@pushrocks/smartdelay';
|
||||||
export { removeme };
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
|
|
||||||
|
export {
|
||||||
|
smartdelay,
|
||||||
|
smartpromise
|
||||||
|
}
|
||||||
|
|
||||||
|
// third party scope
|
||||||
|
import { expect } from 'chai';
|
||||||
|
|
||||||
|
export {
|
||||||
|
expect
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user