New definitions for Jasmine data driven tests

This commit is contained in:
Anthony
2014-08-08 19:57:23 -04:00
parent c773444c76
commit c8706caad0
2 changed files with 61 additions and 0 deletions
@@ -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[], specDefinitions: (...args: any[]) => void): void;
declare function xall(description: string, dataset: any[], specDefinitions: (...args: any[]) => void): void;