diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index fceb55e98..dbbe7b917 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -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)) diff --git a/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts b/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts new file mode 100644 index 000000000..df48df8cf --- /dev/null +++ b/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts @@ -0,0 +1,54 @@ +/// +/// + +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); + } + ); +}); \ No newline at end of file diff --git a/jasmine-data_driven_tests/jasmine-data_driven_tests.d.ts b/jasmine-data_driven_tests/jasmine-data_driven_tests.d.ts new file mode 100644 index 000000000..912720e7f --- /dev/null +++ b/jasmine-data_driven_tests/jasmine-data_driven_tests.d.ts @@ -0,0 +1,7 @@ +// Type definitions for Jasmine Data Driven Tests +// Project: https://github.com/gburghardt/jasmine-data_driven_tests +// Definitions by: Anthony MacKinnon +// 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; \ No newline at end of file