jasmine-given: make done arg non-optional (#35842)

* jasmine-given: make done arg non-optional

* simplify signature

* fix readability for authors

* clean up parentesis
This commit is contained in:
Dmitry A. Efimenko 2019-05-31 11:33:58 -07:00 committed by Sheetal Nandi
parent 06c371e17c
commit d1f694fa3a
2 changed files with 18 additions and 36 deletions

View File

@ -1,7 +1,9 @@
// Type definitions for jasmine-given 2.6
// Project: https://github.com/searls/jasmine-given
// Definitions by: Shai Reznik <https://github.com/shairez>
// Dmitry Efimenko <https://github.com/DmitryEfimenko>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/** Action method that should be called when the async work is complete */
interface DoneFn {
@ -11,9 +13,9 @@ interface DoneFn {
fail: (message?: Error | string) => void;
}
declare function Given(func: (done?: DoneFn) => void): void;
declare function When(func: (done?: DoneFn) => void): void;
declare function Then(func: (done?: DoneFn) => void): void;
declare function Then(label: string, func: (done?: DoneFn) => void): void;
declare function And(func: (done?: DoneFn) => void): void;
declare function Invariant(func: (done?: DoneFn) => void): void;
declare function Given(func: (done: DoneFn) => void): void;
declare function When(func: (done: DoneFn) => void): void;
declare function Then(func: (done: DoneFn) => void): void;
declare function Then(label: string, func: (done: DoneFn) => void): void;
declare function And(func: (done: DoneFn) => void): void;
declare function Invariant(func: (done: DoneFn) => void): void;

View File

@ -11,61 +11,41 @@ And(() => { });
Invariant(() => { });
Given((done) => {
if (done) {
done();
}
done();
});
When((done) => {
if (done) {
done();
}
done();
});
Then('expected condition 2', (done) => {
if (done) {
done();
}
done();
});
And((done) => {
if (done) {
done();
}
done();
});
Invariant((done) => {
if (done) {
done();
}
done();
});
Given((done) => {
if (done) {
done.fail();
}
done.fail();
});
When((done) => {
if (done) {
done.fail();
}
done.fail();
});
Then('expected condition 2', (done) => {
if (done) {
done.fail();
}
done.fail();
});
And((done) => {
if (done) {
done.fail();
}
done.fail();
});
Invariant((done) => {
if (done) {
done.fail();
}
done.fail();
});