Skip to content

Commit

Permalink
Jest: Update tests to newer NodeJS
Browse files Browse the repository at this point in the history
Node has changed the error messages around JSON parsing so that it returns
better details about the encountered errors; update the test expectations
to match the new strings.

Signed-off-by: Mark Yen <mark.yen@suse.com>
  • Loading branch information
mook-as committed Sep 20, 2024
1 parent 3f4a12e commit 96ee486
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ describe('commandLineOptions', () => {

expect(() => {
updateFromCommandLine(prefs, lockedSettings, [`${ arg }=${ value }`]);
}).toThrow(`Can't evaluate ${ arg }=${ value } as number: SyntaxError: Unexpected token a in JSON at position 0`);
}).toThrow(`Can't evaluate ${ arg }=${ value } as number: SyntaxError: Unexpected token 'a', \"angeles\" is not valid JSON`);
});

test('should complain about type mismatches', () => {
Expand Down
2 changes: 1 addition & 1 deletion pkg/rancher-desktop/config/__tests__/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ describe('settings', () => {
return new RegExp(`Error loading plist file .*/io.rancherdesktop.profile.${ basename }.plist`);
}

return new RegExp(`Error parsing deployment profile from .*/\\.config/rancher-desktop.${ basename }.json: SyntaxError: Unexpected end of JSON input`);
return new RegExp(`Error parsing deployment profile from .*/\\.config/rancher-desktop.${ basename }.json: SyntaxError: Unterminated string in JSON at position`);
}
test('complains about invalid default values', async() => {
mock = jest.spyOn(fs, 'readFileSync')
Expand Down

0 comments on commit 96ee486

Please sign in to comment.