-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3184 from Venmit/parjs-fix-constants
paraglide-sveltekit: Fix constants
- Loading branch information
Showing
6 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
inlang/source-code/paraglide/paraglide-sveltekit/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
inlang/source-code/paraglide/paraglide-sveltekit/example/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
inlang/source-code/paraglide/paraglide-sveltekit/example/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
inlang/source-code/paraglide/paraglide-sveltekit/src/constants.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { URL } from "node:url" | ||
import { describe, expect, it } from "vitest" | ||
import * as constants from "./constants" | ||
|
||
const DEPENDS_TYPE_REGEX = /^.*:.*$/ | ||
// eslint-disable-next-line no-control-regex | ||
const COOKIE_NAME_REGEX = /^((?![()<>@,;:"\\/[\]?={} \x09])[\x20-\x7E])+$/ | ||
|
||
describe("LANGUAGE_CHANGE_INVALIDATION_KEY", () => { | ||
it("is a valid URL", () => { | ||
expect(() => new URL(constants.LANGUAGE_CHANGE_INVALIDATION_KEY)).not.toThrowError() | ||
}) | ||
it("conforms to the type of LoadEvent#depends", () => { | ||
expect(constants.LANGUAGE_CHANGE_INVALIDATION_KEY).toMatch(DEPENDS_TYPE_REGEX) | ||
}) | ||
}) | ||
|
||
describe("LANG_COOKIE_NAME", () => { | ||
it("is a valid cookie name", () => { | ||
expect(constants.LANG_COOKIE_NAME).toMatch(COOKIE_NAME_REGEX) | ||
}) | ||
}) |