This repository was archived by the owner on Nov 8, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -14,24 +14,21 @@ function validateMessage(realMessage, expectedMessage) {
14
14
// for validation with the expected message.
15
15
const real = normalize ( coerce ( realMessage ) ) ;
16
16
17
- // Weak coercion applies transformation only to the properties
18
- // present in the given message. We don't want to mutate user's assertion.
19
- // However, we do want to use the same coercion logic we do
20
- // for strict coercion. Thus normalization and coercion are separate .
17
+ // Use weak coercion on expected message.
18
+ // This means that only the properties present in expected message
19
+ // will be coerced. We don't want to mutate user's assertion.
20
+ // However, we want to use the same coercion logic for any coercion type .
21
21
const expected = normalize ( coerceWeak ( expectedMessage ) ) ;
22
22
23
- if ( real . statusCode ) {
23
+ if ( expected . statusCode ) {
24
24
results . statusCode = validateStatusCode ( real , expected ) ;
25
25
}
26
26
27
- if ( real . headers && expected . headers ) {
27
+ if ( expected . headers ) {
28
28
results . headers = validateHeaders ( real , expected ) ;
29
29
}
30
30
31
- if (
32
- isset ( real . body ) &&
33
- ( isset ( expected . body ) || isset ( expected . bodySchema ) )
34
- ) {
31
+ if ( isset ( expected . body ) || isset ( expected . bodySchema ) ) {
35
32
results . body = validateBody ( real , expected ) ;
36
33
}
37
34
You can’t perform that action at this time.
0 commit comments