Add assert.containSubset method; refactor to follow latest style instructions (#13690)

This commit is contained in:
Pasi Eronen
2017-01-02 15:25:52 -08:00
committed by Andy
parent a0da312165
commit f991a320e5
3 changed files with 15 additions and 8 deletions
+3
View File
@@ -29,6 +29,8 @@ function test_containSubset() {
});
obj.should.containSubset({ a: 'b' });
assert.containSubset(obj, { a: 'b' });
}
function test_notContainSubset() {
@@ -52,6 +54,7 @@ function test_arrayContainSubset() {
expect(list).to.containSubset([{a:'a', b: 'b'}]);
list.should.containSubset([{a:'a', b: 'b'}]);
assert.containSubset(list, [{a:'a', b: 'b'}]);
}
function test_arrayNotContainSubset() {
+11 -8
View File
@@ -1,17 +1,20 @@
// Type definitions for chai-subset 1.0.0
// Type definitions for chai-subset 1.3
// Project: https://github.com/e-conomic/chai-subset
// Definitions by: Sam Noedel <https://github.com/delta62/>, Andrew Brown <https://github.com/AGBrown>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="chai" />
declare namespace Chai {
interface Assertion {
containSubset(obj: Object): Assertion;
declare global {
namespace Chai {
interface Assertion {
containSubset(expected: any): Assertion;
}
interface Assert {
containSubset(val: any, exp: any, msg?: string): void;
}
}
}
declare module "chai-subset" {
function chaiSubset(chai: any, utils: any): void;
export = chaiSubset;
}
declare function chaiSubset(chai: any, utils: any): void;
export = chaiSubset;
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }