Skip to content

Instantly share code, notes, and snippets.

@davetron5000
Last active November 26, 2024 14:53
Show Gist options
  • Save davetron5000/3d8dbc405b5a0a18f68668301e555e23 to your computer and use it in GitHub Desktop.
Save davetron5000/3d8dbc405b5a0a18f68668301e555e23 to your computer and use it in GitHub Desktop.
describe("<locale-detection>", () => {
withHTML(`
<locale-detection url="http://example.net/locale">
</locale-detection>
`).onFetch( "/locale", [
{ then: { status: 200 }},
]
).test("Receives the locale and timeZone from the browser",
({document,assert,fetchRequests}) => {
assert.equal(1,fetchRequests.length)
return readBodyIntoJSON(fetchRequests[0]).then( (json) => {
assert.equal(json["locale"],"en-US")
assert.equal(json["timeZone"],"UTC")
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment