mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-05-21 03:34:32 +00:00
Mark optional properties from ArrayContaining and ObjectContaining (#37053)
This commit is contained in:
committed by
Wesley Wigham
parent
9f2a383644
commit
92bbfdf700
8
types/jasmine/index.d.ts
vendored
8
types/jasmine/index.d.ts
vendored
@@ -236,17 +236,17 @@ declare namespace jasmine {
|
||||
}
|
||||
|
||||
interface ArrayContaining<T> {
|
||||
new (sample: ArrayLike<T>): ArrayLike<T>;
|
||||
new?(sample: ArrayLike<T>): ArrayLike<T>;
|
||||
|
||||
asymmetricMatch(other: any): boolean;
|
||||
jasmineToString(): string;
|
||||
jasmineToString?(): string;
|
||||
}
|
||||
|
||||
interface ObjectContaining<T> {
|
||||
new (sample: Partial<T>): Partial<T>;
|
||||
new?(sample: Partial<T>): Partial<T>;
|
||||
|
||||
jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean;
|
||||
jasmineToString(): string;
|
||||
jasmineToString?(): string;
|
||||
}
|
||||
|
||||
interface Block {
|
||||
|
||||
@@ -837,6 +837,29 @@ describe("jasmine.any", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('custom asymmetry', function() {
|
||||
const tester = {
|
||||
asymmetricMatch: (actual: string) => {
|
||||
const secondValue = actual.split(',')[1];
|
||||
return secondValue === 'bar';
|
||||
},
|
||||
};
|
||||
|
||||
it('dives in deep', function() {
|
||||
expect('foo,bar,baz,quux').toEqual(tester);
|
||||
});
|
||||
|
||||
describe('when used with a spy', function() {
|
||||
it('is useful for comparing arguments', function() {
|
||||
const callback = jasmine.createSpy('callback');
|
||||
|
||||
callback('foo,bar,baz');
|
||||
|
||||
expect(callback).toHaveBeenCalledWith(tester);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("jasmine.objectContaining", () => {
|
||||
interface fooType {
|
||||
a: number;
|
||||
|
||||
8
types/jasmine/ts3.1/index.d.ts
vendored
8
types/jasmine/ts3.1/index.d.ts
vendored
@@ -245,17 +245,17 @@ declare namespace jasmine {
|
||||
}
|
||||
|
||||
interface ArrayContaining<T> {
|
||||
new (sample: ArrayLike<T>): ArrayLike<T>;
|
||||
new?(sample: ArrayLike<T>): ArrayLike<T>;
|
||||
|
||||
asymmetricMatch(other: any): boolean;
|
||||
jasmineToString(): string;
|
||||
jasmineToString?(): string;
|
||||
}
|
||||
|
||||
interface ObjectContaining<T> {
|
||||
new (sample: Partial<T>): Partial<T>;
|
||||
new?(sample: Partial<T>): Partial<T>;
|
||||
|
||||
jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean;
|
||||
jasmineToString(): string;
|
||||
jasmineToString?(): string;
|
||||
}
|
||||
|
||||
interface Block {
|
||||
|
||||
@@ -839,6 +839,29 @@ describe("jasmine.any", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('custom asymmetry', function() {
|
||||
const tester = {
|
||||
asymmetricMatch: (actual: string) => {
|
||||
const secondValue = actual.split(',')[1];
|
||||
return secondValue === 'bar';
|
||||
},
|
||||
};
|
||||
|
||||
it('dives in deep', function() {
|
||||
expect('foo,bar,baz,quux').toEqual(tester);
|
||||
});
|
||||
|
||||
describe('when used with a spy', function() {
|
||||
it('is useful for comparing arguments', function() {
|
||||
const callback = jasmine.createSpy('callback');
|
||||
|
||||
callback('foo,bar,baz');
|
||||
|
||||
expect(callback).toHaveBeenCalledWith(tester);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("jasmine.objectContaining", () => {
|
||||
interface fooType {
|
||||
a: number;
|
||||
|
||||
Reference in New Issue
Block a user