|
1 | 1 | // @TODO: Need tests arguments of protected methods |
2 | 2 |
|
| 3 | +import Helper from '@codeceptjs/helper' |
| 4 | +import { expectError, expectType } from 'tsd'; |
| 5 | + |
3 | 6 | class CustomClass extends Helper { |
4 | 7 | constructor(config: any) { |
5 | 8 | super( |
6 | | - config // $ExpectType any |
| 9 | + expectType<any>(config) |
7 | 10 | ) |
8 | | - this.helpers // $ExpectType any |
9 | | - this.debug() // $ExpectError |
10 | | - this.debugSection() // $ExpectError |
11 | | - this.debugSection('[Section]') // $ExpectError |
| 11 | + // @ts-ignore |
| 12 | + expectType<any>(this.helpers) |
| 13 | + expectError(this.debug()) |
| 14 | + expectError(this.debugSection()) |
| 15 | + expectError(this.debugSection('[Section]')) |
12 | 16 |
|
13 | | - this.debug('log') // $ExpectType void |
14 | | - this.debugSection('[Section]', 'log') // $ExpectType void |
| 17 | + // @ts-ignore |
| 18 | + expectType<void>(this.debug('log')) |
| 19 | + // @ts-ignore |
| 20 | + expectType<void>(this.debugSection('[Section]', 'log')) |
15 | 21 | } |
16 | | - _failed() {} // $ExpectType () => void |
17 | | - _finishTest() {} // $ExpectType () => void |
18 | | - _init() {} // $ExpectType () => void |
19 | | - _passed() {} // $ExpectType () => void |
20 | | - _setConfig() {} // $ExpectType () => void |
21 | | - _useTo() {} // $ExpectType () => void |
22 | | - _validateConfig() {} // $ExpectType () => void |
23 | | - _before() {} // $ExpectType () => void |
24 | | - _beforeStep() {} // $ExpectType () => void |
25 | | - _beforeSuite() {} // $ExpectType () => void |
26 | | - _after() {} // $ExpectType () => void |
27 | | - _afterStep() {} // $ExpectType () => void |
28 | | - _afterSuite() {} // $ExpectType () => void |
| 22 | + _failed() {} |
| 23 | + _finishTest() {} |
| 24 | + _init() {} |
| 25 | + _passed() {} |
| 26 | + _setConfig() {} |
| 27 | + _useTo() {} |
| 28 | + _validateConfig() {} |
| 29 | + _before() {} |
| 30 | + _beforeStep() {} |
| 31 | + _beforeSuite() {} |
| 32 | + _after() {} |
| 33 | + _afterStep() {} |
| 34 | + _afterSuite() {} |
29 | 35 | } |
30 | 36 |
|
31 | | -const customClass = new Helper({}) |
| 37 | +const customClass = new CustomClass({}) |
32 | 38 |
|
33 | | -customClass._failed() // $ExpectError |
34 | | -customClass._finishTest() // $ExpectError |
35 | | -customClass._init() // $ExpectError |
36 | | -customClass._passed() // $ExpectError |
37 | | -customClass._setConfig() // $ExpectError |
38 | | -customClass._validateConfig() // $ExpectError |
39 | | -customClass._before() // $ExpectError |
40 | | -customClass._beforeStep() // $ExpectError |
41 | | -customClass._beforeSuite() // $ExpectError |
42 | | -customClass._after() // $ExpectError |
43 | | -customClass._afterStep() // $ExpectError |
44 | | -customClass._afterSuite() // $ExpectError |
| 39 | +expectType<void>(customClass._failed()) |
| 40 | +expectType<void>(customClass._finishTest()) |
| 41 | +expectType<void>(customClass._init()) |
| 42 | +expectType<void>(customClass._passed()) |
| 43 | +expectType<void>(customClass._setConfig()) |
| 44 | +expectType<void>(customClass._validateConfig()) |
| 45 | +expectType<void>(customClass._before()) |
| 46 | +expectType<void>(customClass._beforeStep()) |
| 47 | +expectType<void>(customClass._beforeSuite()) |
| 48 | +expectType<void>(customClass._after()) |
| 49 | +expectType<void>(customClass._afterStep()) |
| 50 | +expectType<void>(customClass._afterSuite()) |
45 | 51 |
|
46 | | -customClass._useTo() // $ExpectType void |
| 52 | +expectType<void>(customClass._useTo()) |
0 commit comments