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",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.11",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@pushrocks/smartexpect",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.11",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@pushrocks/smartdelay": "^2.0.13",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartexpect",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.11",
|
||||
"private": false,
|
||||
"description": "manage expectations in code",
|
||||
"main": "dist_ts/index.js",
|
||||
|
@ -36,4 +36,12 @@ tap.test('should be greater than', async () => {
|
||||
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();
|
||||
|
@ -187,13 +187,12 @@ export class Assertion {
|
||||
|
||||
public toContain(itemArg: any) {
|
||||
return this.runCheck(() => {
|
||||
const result = this.baseReference instanceof Array && this.baseReference.find(itemArg2 => {
|
||||
itemArg === itemArg2;
|
||||
})
|
||||
const result =
|
||||
this.baseReference instanceof Array &&
|
||||
this.baseReference.includes(itemArg);
|
||||
if (!result) {
|
||||
throw new Error(`${this.baseReference} is not contain ${itemArg}`);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user