|
| 1 | +import {expectError} from 'tsd'; |
| 2 | +import test, {ExecutionContext, Implementation, ImplementationWithArgs} from '../experimental'; |
| 3 | + |
| 4 | +test('title', t => t.pass()); |
| 5 | + |
| 6 | +expectError(test<[string]>('explicit argument type', t => t.pass(), 42)); |
| 7 | + |
| 8 | +expectError(test<[string]>('missing argument', (t: ExecutionContext) => t.pass())); |
| 9 | + |
| 10 | +test<string[]>('optional arguments', t => t.pass()); |
| 11 | +test<string[]>('optional arguments, with values', t => t.pass(), 'foo', 'bar'); |
| 12 | + |
| 13 | +expectError(test('argument type inferred from implementation', (t, string) => t.is(string, 'foo'), 42)); |
| 14 | + |
| 15 | +expectError(test('argument type inferred in implementation', (t, string) => t.is(string, 'foo'), 42)); |
| 16 | + |
| 17 | +{ |
| 18 | + const implementation: Implementation = t => t.pass(); |
| 19 | + expectError(test('unexpected arguments', implementation, 'foo')); |
| 20 | +} |
| 21 | + |
| 22 | +{ |
| 23 | + const implementation: ImplementationWithArgs<[string]> = (t, string) => t.is(string, 'foo'); |
| 24 | + test('unexpected arguments', implementation, 'foo'); |
| 25 | +} |
| 26 | + |
| 27 | +test.failing<[string]>('failing test with arguments', (t, string) => t.is(string, 'foo'), 'foo'); |
| 28 | +test.only<[string]>('only test with arguments', (t, string) => t.is(string, 'foo'), 'foo'); |
| 29 | +test.skip<[string]>('serial test with arguments', (t, string) => t.is(string, 'foo'), 'foo'); |
| 30 | + |
| 31 | +test.after.always.skip<[string]>('after.always hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 32 | +test.after.always.skip<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 33 | +test.after.always<[string]>('after.always hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 34 | +test.after.always<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 35 | +test.after.skip<[string]>('after hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 36 | +test.after.skip<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 37 | +test.after<[string]>('after hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 38 | +test.after<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 39 | +test.afterEach.always.skip<[string]>('after.always hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 40 | +test.afterEach.always.skip<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 41 | +test.afterEach.always<[string]>('after.always hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 42 | +test.afterEach.always<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 43 | +test.afterEach.skip<[string]>('after hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 44 | +test.afterEach.skip<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 45 | +test.afterEach<[string]>('after hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 46 | +test.afterEach<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 47 | +test.before.skip<[string]>('before hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 48 | +test.before.skip<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 49 | +test.before<[string]>('before hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 50 | +test.before<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 51 | +test.beforeEach.skip<[string]>('before hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 52 | +test.beforeEach.skip<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 53 | +test.beforeEach<[string]>('before hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 54 | +test.beforeEach<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 55 | + |
| 56 | +test.serial('title', t => t.pass()); |
| 57 | + |
| 58 | +expectError(test.serial<[string]>('explicit argument type', t => t.pass(), 42)); |
| 59 | + |
| 60 | +expectError(test.serial<[string]>('missing argument', (t: ExecutionContext) => t.pass())); |
| 61 | + |
| 62 | +test.serial<string[]>('optional arguments', t => t.pass()); |
| 63 | +test.serial<string[]>('optional arguments, with values', t => t.pass(), 'foo', 'bar'); |
| 64 | + |
| 65 | +expectError(test.serial('argument type inferred from implementation', (t, string) => t.is(string, 'foo'), 42)); |
| 66 | + |
| 67 | +expectError(test.serial('argument type inferred in implementation', (t, string) => t.is(string, 'foo'), 42)); |
| 68 | + |
| 69 | +{ |
| 70 | + const implementation: Implementation = t => t.pass(); |
| 71 | + expectError(test.serial('unexpected arguments', implementation, 'foo')); |
| 72 | +} |
| 73 | + |
| 74 | +{ |
| 75 | + const implementation: ImplementationWithArgs<[string]> = (t, string) => t.is(string, 'foo'); |
| 76 | + test.serial('unexpected arguments', implementation, 'foo'); |
| 77 | +} |
| 78 | + |
| 79 | +test.serial.failing<[string]>('failing test with arguments', (t, string) => t.is(string, 'foo'), 'foo'); |
| 80 | +test.serial.only<[string]>('only test with arguments', (t, string) => t.is(string, 'foo'), 'foo'); |
| 81 | +test.serial.skip<[string]>('serial test with arguments', (t, string) => t.is(string, 'foo'), 'foo'); |
| 82 | + |
| 83 | +test.serial.after.always.skip<[string]>('after.always hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 84 | +test.serial.after.always.skip<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 85 | +test.serial.after.always<[string]>('after.always hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 86 | +test.serial.after.always<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 87 | +test.serial.after.skip<[string]>('after hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 88 | +test.serial.after.skip<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 89 | +test.serial.after<[string]>('after hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 90 | +test.serial.after<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 91 | +test.serial.afterEach.always.skip<[string]>('after.always hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 92 | +test.serial.afterEach.always.skip<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 93 | +test.serial.afterEach.always<[string]>('after.always hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 94 | +test.serial.afterEach.always<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 95 | +test.serial.afterEach.skip<[string]>('after hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 96 | +test.serial.afterEach.skip<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 97 | +test.serial.afterEach<[string]>('after hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 98 | +test.serial.afterEach<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 99 | +test.serial.before.skip<[string]>('before hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 100 | +test.serial.before.skip<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 101 | +test.serial.before<[string]>('before hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 102 | +test.serial.before<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 103 | +test.serial.beforeEach.skip<[string]>('before hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 104 | +test.serial.beforeEach.skip<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
| 105 | +test.serial.beforeEach<[string]>('before hook with args', (t, string) => t.is(string, 'foo'), 'foo'); |
| 106 | +test.serial.beforeEach<[string]>((t, string) => t.is(string, 'foo'), 'foo'); |
0 commit comments