Describes a group of related tests.
interface
test.Describe
interface Describe
function sum(a, b) {
return a + b;
}
describe("sum()", () => {
test("can sum two values", () => {
expect(sum(1, 1)).toBe(2);
});
});
- table: readonly T[]): (label: DescribeLabel, fn: (...args: [...T[]]) => void | Promise<unknown>, options?: number | TestOptions) => void;
Returns a function that runs for each item in
table
.@param tableArray of Arrays with the arguments that are passed into the test fn for each row.
table: readonly T[]): (label: DescribeLabel, fn: (...args: Readonly<T>) => void | Promise<unknown>, options?: number | TestOptions) => void;table: T[]): (label: DescribeLabel, fn: (...args: T[]) => void | Promise<unknown>, options?: number | TestOptions) => void; - if(condition: boolean): (label: DescribeLabel, fn: () => void) => void;
Runs this group of tests, only if
condition
is true.This is the opposite of
describe.skipIf()
.@param conditionif these tests should run
- @param label
the label for the tests
@param fnthe function that defines the tests
- @param label
the label for the tests
@param fnthe function that defines the tests
- condition: boolean): (label: DescribeLabel, fn: () => void) => void;
Skips this group of tests, if
condition
is true.@param conditionif these tests should be skipped
- todo(label: DescribeLabel,fn?: () => void): void;
Marks this group of tests as to be written or to be fixed.
@param labelthe label for the tests
@param fnthe function that defines the tests
- condition: boolean): (label: DescribeLabel, fn: () => void) => void;
Marks this group of tests as to be written or to be fixed, if
condition
is true.@param conditionif these tests should be skipped