mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
Use Partial keyword for objectContaining
This commit is contained in:
Vendored
+3
-3
@@ -49,7 +49,7 @@ declare namespace jasmine {
|
||||
function any(aclass: any): Any;
|
||||
function anything(): Any;
|
||||
function arrayContaining(sample: any[]): ArrayContaining;
|
||||
function objectContaining(sample: any): ObjectContaining;
|
||||
function objectContaining<T>(sample: Partial<T>): ObjectContaining<T>;
|
||||
function createSpy(name: string, originalFn?: Function): Spy;
|
||||
function createSpyObj(baseName: string, methodNames: any[]): any;
|
||||
function createSpyObj<T>(baseName: string, methodNames: any[]): T;
|
||||
@@ -82,8 +82,8 @@ declare namespace jasmine {
|
||||
jasmineToString(): string;
|
||||
}
|
||||
|
||||
interface ObjectContaining {
|
||||
new (sample: any): any;
|
||||
interface ObjectContaining<T> {
|
||||
new (sample: Partial<T>): T;
|
||||
|
||||
jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean;
|
||||
jasmineToString(): string;
|
||||
|
||||
@@ -663,7 +663,12 @@ describe("jasmine.any", function () {
|
||||
});
|
||||
|
||||
describe("jasmine.objectContaining", function () {
|
||||
var foo: any;
|
||||
interface fooType {
|
||||
a:number;
|
||||
b:number;
|
||||
bar:string;
|
||||
}
|
||||
var foo: fooType;
|
||||
|
||||
beforeEach(function () {
|
||||
foo = {
|
||||
@@ -674,11 +679,11 @@ describe("jasmine.objectContaining", function () {
|
||||
});
|
||||
|
||||
it("matches objects with the expect key/value pairs", function () {
|
||||
expect(foo).toEqual(jasmine.objectContaining({
|
||||
expect(foo).toEqual(jasmine.objectContaining<fooType>({
|
||||
bar: "baz"
|
||||
}));
|
||||
expect(foo).not.toEqual(jasmine.objectContaining({
|
||||
c: 37
|
||||
expect(foo).not.toEqual(jasmine.objectContaining<fooType>({
|
||||
a: 37
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user