From b9bb0662a9c23cad3b5f200cf2a9588539ed5f0c Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Tue, 6 Feb 2018 21:05:58 +0000 Subject: curried option functions --- src/matcher/options.test.ts | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/matcher/options.test.ts') diff --git a/src/matcher/options.test.ts b/src/matcher/options.test.ts index 6c2cfe5..f3d498c 100644 --- a/src/matcher/options.test.ts +++ b/src/matcher/options.test.ts @@ -14,7 +14,7 @@ describe('Object Matching:', () => { let matchee = { a: "yes" }; - options.rough(template, matchee).should.be.true; + options.match(template, matchee).should.be.true; }); it('accepts objects with superfluous properties', () => { let template = { @@ -24,7 +24,7 @@ describe('Object Matching:', () => { a: 40, b: 20 }; - options.rough(template, matchee).should.be.true; + options.match(template, matchee).should.be.true; }); it('rejects objects missing some properties', () => { let template = { @@ -35,7 +35,7 @@ describe('Object Matching:', () => { let matchee = { b: 5 }; - options.rough(template, matchee).should.be.false; + options.match(template, matchee).should.be.false; }); it('accepts objects that omit not_present properties', () => { let template = { @@ -46,7 +46,22 @@ describe('Object Matching:', () => { let matchee = { a: new Function() }; - options.rough(template, matchee).should.be.true; + options.match(template, matchee).should.be.true; + }); + it('rejects empty objects for non-empty templates', () => { + let template = { + a: types.boolean + }; + let matchee = { + }; + options.match(template, matchee).should.be.false; + }); + it('accepts empty objects for empty templates', () => { + let template = { + }; + let matchee = { + }; + options.match(template, matchee).should.be.true; }); }); }); -- cgit v1.2.1