@@ -11,13 +11,13 @@ import { assertableSymbol } from "../assertable.js";
11
11
12
12
export const toRerender : MatcherFunction < [ options ?: NextRenderOptions ] > =
13
13
async function ( actual , options ) {
14
- const _profiler = actual as RenderStream < any > | Assertable ;
15
- const profiler =
16
- assertableSymbol in _profiler ? _profiler [ assertableSymbol ] : _profiler ;
14
+ const _stream = actual as RenderStream < any > | Assertable ;
15
+ const stream =
16
+ assertableSymbol in _stream ? _stream [ assertableSymbol ] : _stream ;
17
17
const hint = this . utils . matcherHint ( "toRerender" , "ProfiledComponent" , "" ) ;
18
18
let pass = true ;
19
19
try {
20
- await profiler . peekRender ( { timeout : 100 , ...options } ) ;
20
+ await stream . peekRender ( { timeout : 100 , ...options } ) ;
21
21
} catch ( e ) {
22
22
if ( e instanceof WaitForRenderTimeoutError ) {
23
23
pass = false ;
@@ -44,26 +44,26 @@ const failed = {};
44
44
export const toRenderExactlyTimes : MatcherFunction <
45
45
[ times : number , options ?: NextRenderOptions ]
46
46
> = async function ( actual , times , optionsPerRender ) {
47
- const _profiler = actual as RenderStream < any > | Assertable ;
48
- const profiler =
49
- assertableSymbol in _profiler ? _profiler [ assertableSymbol ] : _profiler ;
47
+ const _stream = actual as RenderStream < any > | Assertable ;
48
+ const stream =
49
+ assertableSymbol in _stream ? _stream [ assertableSymbol ] : _stream ;
50
50
const options = { timeout : 100 , ...optionsPerRender } ;
51
51
const hint = this . utils . matcherHint ( "toRenderExactlyTimes" ) ;
52
52
let pass = true ;
53
53
try {
54
- if ( profiler . totalRenderCount ( ) > times ) {
54
+ if ( stream . totalRenderCount ( ) > times ) {
55
55
throw failed ;
56
56
}
57
57
try {
58
- while ( profiler . totalRenderCount ( ) < times ) {
59
- await profiler . waitForNextRender ( options ) ;
58
+ while ( stream . totalRenderCount ( ) < times ) {
59
+ await stream . waitForNextRender ( options ) ;
60
60
}
61
61
} catch ( e ) {
62
62
// timeouts here should just fail the test, rethrow other errors
63
63
throw e instanceof WaitForRenderTimeoutError ? failed : e ;
64
64
}
65
65
try {
66
- await profiler . waitForNextRender ( options ) ;
66
+ await stream . waitForNextRender ( options ) ;
67
67
} catch ( e ) {
68
68
// we are expecting a timeout here, so swallow that error, rethrow others
69
69
if ( ! ( e instanceof WaitForRenderTimeoutError ) ) {
@@ -83,7 +83,7 @@ export const toRenderExactlyTimes: MatcherFunction<
83
83
return (
84
84
hint +
85
85
` Expected component to${ pass ? " not" : "" } render exactly ${ times } .` +
86
- ` It rendered ${ profiler . totalRenderCount ( ) } times.`
86
+ ` It rendered ${ stream . totalRenderCount ( ) } times.`
87
87
) ;
88
88
} ,
89
89
} ;
0 commit comments