Skip to content

Commit

Permalink
test: should serialize storageState with lone surrogates (#1464)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Jan 29, 2024
1 parent c4e1f89 commit 77e5999
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,20 @@ void shouldRoundTripThroughTheFile(@TempDir Path tempDir) throws IOException {
}
context2.close();
}

@Test
void shouldSerialiseStorageStateWithLoneSurrogates() {
page.navigate(server.EMPTY_PAGE);
page.evaluate("chars => window.localStorage.setItem('foo', String.fromCharCode(55934))");
String storageState = context.storageState();
assertJsonEquals("{" +
"cookies:[]," +
"origins:[{\n" +
" origin: 'http://localhost:" + server.PORT + "',\n" +
" localStorage: [{\n" +
" name: 'foo',\n" +
" value: '" + (char)55934 + "'\n" +
" }]\n" +
"}]}", new Gson().fromJson(storageState, JsonObject.class));
}
}

0 comments on commit 77e5999

Please sign in to comment.