Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
52b8a3f0d1 | |||
9213e7905f | |||
56fb434f7d | |||
b147de4713 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartexpect",
|
"name": "@pushrocks/smartexpect",
|
||||||
"version": "1.0.9",
|
"version": "1.0.11",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@pushrocks/smartexpect",
|
"name": "@pushrocks/smartexpect",
|
||||||
"version": "1.0.9",
|
"version": "1.0.11",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartdelay": "^2.0.13",
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartexpect",
|
"name": "@pushrocks/smartexpect",
|
||||||
"version": "1.0.9",
|
"version": "1.0.11",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "manage expectations in code",
|
"description": "manage expectations in code",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -36,4 +36,12 @@ tap.test('should be greater than', async () => {
|
|||||||
smartexpect.expect(4).toBeLessThan(5);
|
smartexpect.expect(4).toBeLessThan(5);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
tap.test('should correctly determine toContain', async () => {
|
||||||
|
const hello = {
|
||||||
|
socool: 'yes'
|
||||||
|
};
|
||||||
|
const testArray = [hello];
|
||||||
|
smartexpect.expect(testArray).toContain(hello);
|
||||||
|
})
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -187,13 +187,12 @@ export class Assertion {
|
|||||||
|
|
||||||
public toContain(itemArg: any) {
|
public toContain(itemArg: any) {
|
||||||
return this.runCheck(() => {
|
return this.runCheck(() => {
|
||||||
const result = this.baseReference instanceof Array && this.baseReference.find(itemArg2 => {
|
const result =
|
||||||
itemArg === itemArg2;
|
this.baseReference instanceof Array &&
|
||||||
})
|
this.baseReference.includes(itemArg);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
throw new Error(`${this.baseReference} is not contain ${itemArg}`);
|
throw new Error(`${this.baseReference} is not contain ${itemArg}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user