mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-10 11:40:16 +08:00
Merge pull request #2655 from Georadix/def/jasmine-data_driven_tests
Definitions for Jasmine Data Driven Tests
This commit is contained in:
@@ -139,6 +139,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [IxJS (Interactive extensions)](https://github.com/Reactive-Extensions/IxJS) (by [Igor Oleinikov](https://github.com/Igorbek))
|
||||
* [jake](https://github.com/mde/jake) (by [Kon](http://phyzkit.net/))
|
||||
* [Jasmine](http://pivotal.github.com/jasmine/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Jasmine-data_driven_tests](https://github.com/gburghardt/jasmine-data_driven_tests) (by [Anthony MacKinnon](https://github.com/AnthonyMacKinnon))
|
||||
* [Jasmine-jQuery](https://github.com/velesin/jasmine-jquery) (by [Gregor Stamac](https://github.com/gstamac))
|
||||
* [jDataView](https://github.com/jDataView/jDataView) (by [Ingvar Stepanyan](https://github.com/RReverser))
|
||||
* [JointJS](http://www.jointjs.com/) (by [Aidan Reel](http://github.com/areel))
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/// <reference path="jasmine-data_driven_tests.d.ts" />
|
||||
/// <reference path="../jasmine/jasmine.d.ts" />
|
||||
|
||||
all("A data driven test is a suite with multiple specs",
|
||||
['a', 'b', 'c'],
|
||||
(value: string) => {
|
||||
expect(value).not.toBe('d');
|
||||
}
|
||||
);
|
||||
|
||||
all("A data driven test can have many arguments",
|
||||
[
|
||||
[1, 2, 3],
|
||||
[2, 4, 6]
|
||||
],
|
||||
(a: number, b: number, c: number) => {
|
||||
expect(c - (a + b)).toBe(0);
|
||||
}
|
||||
);
|
||||
|
||||
all("A data driven test can be asynchronous",
|
||||
[
|
||||
[3, 1],
|
||||
[5, 2]
|
||||
],
|
||||
(a: number, b: number, done: () => void) => {
|
||||
setTimeout(() => {
|
||||
expect(a - b > 0).toBe(true);
|
||||
done();
|
||||
}, 50);
|
||||
}
|
||||
);
|
||||
|
||||
xall("A data driven test can be pending",
|
||||
[1, 2, 3],
|
||||
(value: number) => {
|
||||
expect(value < 4).toBe(true);
|
||||
}
|
||||
);
|
||||
|
||||
describe("A suite", () => {
|
||||
var a: number;
|
||||
|
||||
beforeEach(() => {
|
||||
a = 5;
|
||||
});
|
||||
|
||||
all("can contain data driven tests",
|
||||
[1, 2, 3],
|
||||
(b: number) => {
|
||||
expect(a - b > 0).toBe(true);
|
||||
}
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
// Type definitions for Jasmine Data Driven Tests
|
||||
// Project: https://github.com/gburghardt/jasmine-data_driven_tests
|
||||
// Definitions by: Anthony MacKinnon <https://github.com/AnthonyMacKinnon>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare function all(description: string, dataset: any[], assertion: (...args: any[]) => void): void;
|
||||
declare function xall(description: string, dataset: any[], assertion: (...args: any[]) => void): void;
|
||||
Reference in New Issue
Block a user