5
5
* LICENSE file in the root directory of this source tree.
6
6
*/
7
7
8
- import { expectError , expectType } from 'tsd-lite ' ;
8
+ import { expect } from 'tstyche ' ;
9
9
import {
10
10
type AggregatedResult ,
11
11
type Config ,
@@ -25,73 +25,89 @@ declare const testResult: TestResult;
25
25
26
26
// utils.formatTestPath()
27
27
28
- expectType < string > ( utils . formatTestPath ( globalConfig , 'some/path' ) ) ;
29
- expectType < string > ( utils . formatTestPath ( projectConfig , 'some/path' ) ) ;
30
- expectError ( utils . formatTestPath ( ) ) ;
31
- expectError ( utils . formatTestPath ( { } , 'some/path' ) ) ;
32
- expectError ( utils . formatTestPath ( globalConfig , 123 ) ) ;
33
- expectError ( utils . formatTestPath ( projectConfig , 123 ) ) ;
28
+ expect ( utils . formatTestPath ( globalConfig , 'some/path' ) ) . type . toBeString ( ) ;
29
+ expect ( utils . formatTestPath ( projectConfig , 'some/path' ) ) . type . toBeString ( ) ;
30
+ expect ( utils . formatTestPath ( ) ) . type . toRaiseError ( ) ;
31
+ expect ( utils . formatTestPath ( { } , 'some/path' ) ) . type . toRaiseError ( ) ;
32
+ expect ( utils . formatTestPath ( globalConfig , 123 ) ) . type . toRaiseError ( ) ;
33
+ expect ( utils . formatTestPath ( projectConfig , 123 ) ) . type . toRaiseError ( ) ;
34
34
35
35
// utils.getResultHeader()
36
36
37
- expectType < string > (
37
+ expect (
38
38
utils . getResultHeader ( testResult , globalConfig , projectConfig ) ,
39
- ) ;
40
- expectType < string > ( utils . getResultHeader ( testResult , globalConfig ) ) ;
41
- expectError ( utils . getResultHeader ( ) ) ;
42
- expectError ( utils . getResultHeader ( { } , globalConfig ) ) ;
43
- expectError ( utils . getResultHeader ( { } , globalConfig , projectConfig ) ) ;
44
- expectError ( utils . getResultHeader ( testResult , { } ) ) ;
45
- expectError ( utils . getResultHeader ( testResult , globalConfig , { } ) ) ;
39
+ ) . type . toBeString ( ) ;
40
+ expect ( utils . getResultHeader ( testResult , globalConfig ) ) . type . toBeString ( ) ;
41
+ expect ( utils . getResultHeader ( ) ) . type . toRaiseError ( ) ;
42
+ expect ( utils . getResultHeader ( { } , globalConfig ) ) . type . toRaiseError ( ) ;
43
+ expect (
44
+ utils . getResultHeader ( { } , globalConfig , projectConfig ) ,
45
+ ) . type . toRaiseError ( ) ;
46
+ expect ( utils . getResultHeader ( testResult , { } ) ) . type . toRaiseError ( ) ;
47
+ expect ( utils . getResultHeader ( testResult , globalConfig , { } ) ) . type . toRaiseError ( ) ;
46
48
47
49
// utils.getSnapshotStatus()
48
50
49
- expectType < Array < string > > ( utils . getSnapshotStatus ( snapshot , true ) ) ;
50
- expectError ( utils . getSnapshotStatus ( ) ) ;
51
- expectError ( utils . getSnapshotStatus ( { } , true ) ) ;
52
- expectError ( utils . getSnapshotStatus ( snapshot , 123 ) ) ;
51
+ expect ( utils . getSnapshotStatus ( snapshot , true ) ) . type . toEqual < Array < string > > ( ) ;
52
+ expect ( utils . getSnapshotStatus ( ) ) . type . toRaiseError ( ) ;
53
+ expect ( utils . getSnapshotStatus ( { } , true ) ) . type . toRaiseError ( ) ;
54
+ expect ( utils . getSnapshotStatus ( snapshot , 123 ) ) . type . toRaiseError ( ) ;
53
55
54
56
// utils.getSnapshotSummary()
55
57
56
- expectType < Array < string > > (
58
+ expect (
57
59
utils . getSnapshotSummary ( snapshotSummary , globalConfig , 'press `u`' ) ,
58
- ) ;
59
- expectError ( utils . getSnapshotSummary ( ) ) ;
60
- expectError ( utils . getSnapshotSummary ( { } , globalConfig , 'press `u`' ) ) ;
61
- expectError ( utils . getSnapshotSummary ( snapshotSummary , { } , 'press `u`' ) ) ;
62
- expectError ( utils . getSnapshotSummary ( snapshotSummary , globalConfig , true ) ) ;
60
+ ) . type . toEqual < Array < string > > ( ) ;
61
+ expect ( utils . getSnapshotSummary ( ) ) . type . toRaiseError ( ) ;
62
+ expect (
63
+ utils . getSnapshotSummary ( { } , globalConfig , 'press `u`' ) ,
64
+ ) . type . toRaiseError ( ) ;
65
+ expect (
66
+ utils . getSnapshotSummary ( snapshotSummary , { } , 'press `u`' ) ,
67
+ ) . type . toRaiseError ( ) ;
68
+ expect (
69
+ utils . getSnapshotSummary ( snapshotSummary , globalConfig , true ) ,
70
+ ) . type . toRaiseError ( ) ;
63
71
64
72
// utils.getSummary()
65
73
66
- expectType < string > ( utils . getSummary ( aggregatedResults , summaryOptions ) ) ;
67
- expectType < string > ( utils . getSummary ( aggregatedResults ) ) ;
68
- expectError ( utils . getSummary ( ) ) ;
69
- expectError ( utils . getSummary ( { } ) ) ;
70
- expectError ( utils . getSummary ( aggregatedResults , true ) ) ;
74
+ expect ( utils . getSummary ( aggregatedResults , summaryOptions ) ) . type . toBeString ( ) ;
75
+ expect ( utils . getSummary ( aggregatedResults ) ) . type . toBeString ( ) ;
76
+ expect ( utils . getSummary ( ) ) . type . toRaiseError ( ) ;
77
+ expect ( utils . getSummary ( { } ) ) . type . toRaiseError ( ) ;
78
+ expect ( utils . getSummary ( aggregatedResults , true ) ) . type . toRaiseError ( ) ;
71
79
72
80
// utils.printDisplayName()
73
81
74
- expectType < string > ( utils . printDisplayName ( projectConfig ) ) ;
75
- expectError ( utils . printDisplayName ( ) ) ;
76
- expectError ( utils . printDisplayName ( { } ) ) ;
82
+ expect ( utils . printDisplayName ( projectConfig ) ) . type . toBeString ( ) ;
83
+ expect ( utils . printDisplayName ( ) ) . type . toRaiseError ( ) ;
84
+ expect ( utils . printDisplayName ( { } ) ) . type . toRaiseError ( ) ;
77
85
78
86
// utils.relativePath()
79
87
80
- expectType < { basename : string ; dirname : string } > (
81
- utils . relativePath ( globalConfig , 'some/path' ) ,
82
- ) ;
83
- expectType < { basename : string ; dirname : string } > (
84
- utils . relativePath ( projectConfig , 'some/path' ) ,
85
- ) ;
86
- expectError ( utils . relativePath ( ) ) ;
87
- expectError ( utils . relativePath ( { } , 'some/path' ) ) ;
88
- expectError ( utils . relativePath ( projectConfig , true ) ) ;
88
+ expect ( utils . relativePath ( globalConfig , 'some/path' ) ) . type . toEqual < {
89
+ basename : string ;
90
+ dirname : string ;
91
+ } > ( ) ;
92
+ expect ( utils . relativePath ( projectConfig , 'some/path' ) ) . type . toEqual < {
93
+ basename : string ;
94
+ dirname : string ;
95
+ } > ( ) ;
96
+ expect ( utils . relativePath ( ) ) . type . toRaiseError ( ) ;
97
+ expect ( utils . relativePath ( { } , 'some/path' ) ) . type . toRaiseError ( ) ;
98
+ expect ( utils . relativePath ( projectConfig , true ) ) . type . toRaiseError ( ) ;
89
99
90
100
// utils.trimAndFormatPath()
91
101
92
- expectType < string > ( utils . trimAndFormatPath ( 2 , globalConfig , 'some/path' , 4 ) ) ;
93
- expectError ( utils . trimAndFormatPath ( ) ) ;
94
- expectError ( utils . trimAndFormatPath ( true , globalConfig , 'some/path' , 4 ) ) ;
95
- expectError ( utils . trimAndFormatPath ( 2 , { } , 'some/path' , 4 ) ) ;
96
- expectError ( utils . trimAndFormatPath ( 2 , globalConfig , true , 4 ) ) ;
97
- expectError ( utils . trimAndFormatPath ( 2 , globalConfig , 'some/path' , '4' ) ) ;
102
+ expect (
103
+ utils . trimAndFormatPath ( 2 , globalConfig , 'some/path' , 4 ) ,
104
+ ) . type . toBeString ( ) ;
105
+ expect ( utils . trimAndFormatPath ( ) ) . type . toRaiseError ( ) ;
106
+ expect (
107
+ utils . trimAndFormatPath ( true , globalConfig , 'some/path' , 4 ) ,
108
+ ) . type . toRaiseError ( ) ;
109
+ expect ( utils . trimAndFormatPath ( 2 , { } , 'some/path' , 4 ) ) . type . toRaiseError ( ) ;
110
+ expect ( utils . trimAndFormatPath ( 2 , globalConfig , true , 4 ) ) . type . toRaiseError ( ) ;
111
+ expect (
112
+ utils . trimAndFormatPath ( 2 , globalConfig , 'some/path' , '4' ) ,
113
+ ) . type . toRaiseError ( ) ;
0 commit comments