From 624237a55346531ec0b6e9194895d36993eab051 Mon Sep 17 00:00:00 2001 From: Adam Babcock Date: Thu, 10 Dec 2015 09:34:27 -0600 Subject: [PATCH] Add containDeepOrdered --- should/should-tests.ts | 7 +++++++ should/should.d.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/should/should-tests.ts b/should/should-tests.ts index c940f7c13..43b21d0ef 100644 --- a/should/should-tests.ts +++ b/should/should-tests.ts @@ -172,3 +172,10 @@ obj.should.have.keys('foo', 'bar'); obj.should.have.keys(['foo', 'bar']); (1).should.eql(0, 'some useful description'); + +[ 1, 2, 3].should.containDeepOrdered([1, 2]); +[ 1, 2, [ 1, 2, 3 ]].should.containDeepOrdered([ 1, [ 2, 3 ]]); + +({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({a: 10}); +({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({b: {c: 10}}); +({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({b: {d: [1, 3]}}); diff --git a/should/should.d.ts b/should/should.d.ts index ba32f571b..26a42d7ed 100644 --- a/should/should.d.ts +++ b/should/should.d.ts @@ -64,6 +64,7 @@ interface ShouldAssertion { contain(obj: any): ShouldAssertion; containEql(obj: any): ShouldAssertion; containDeep(obj: any): ShouldAssertion; + containDeepOrdered(obj: any): ShouldAssertion; keys(...allKeys: string[]): ShouldAssertion; keys(allKeys: string[]): ShouldAssertion; header(field: string, val?: string): ShouldAssertion;