From 6a7989fdfe160a5a03bdaf84e0ede5fe840533b5 Mon Sep 17 00:00:00 2001 From: Denis Bardadym Date: Sat, 28 Oct 2017 14:01:37 +0300 Subject: [PATCH] Fix #157 --- lib/ext/contain.js | 2 +- test/ext/contain.test.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ext/contain.js b/lib/ext/contain.js index 808f18a..56c87dd 100644 --- a/lib/ext/contain.js +++ b/lib/ext/contain.js @@ -138,7 +138,7 @@ export default function(should, Assertion) { this.params = { operator: "to contain " + i(other) }; var obj = this.obj; - if (typeof obj == "string") { + if (typeof obj === "string" && typeof other === "string") { // expect other to be string this.is.equal(String(other)); } else if (isIterable(obj) && isIterable(other)) { diff --git a/test/ext/contain.test.js b/test/ext/contain.test.js index 094c37f..e78c286 100644 --- a/test/ext/contain.test.js +++ b/test/ext/contain.test.js @@ -54,6 +54,7 @@ describe("contain*", function() { [1, 2, 3].should.containDeep([3, 2]); ["code-for-days", "code"].should.containDeep(["code", "code-for-days"]); + ({ a: "hello" }.should.not.containDeep({ a: ["hello"] })); ["code-for-days", "code-fast"].should.containDeep(["code-fast", "code-for-days"]); err(function() {