Skip to content

Commit 42c637a

Browse files
committed
wip
1 parent 4499d58 commit 42c637a

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

tests/rules/no-unnormalized-keys.test.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,36 @@ ruleTester.run("no-unnormalized-keys", rule, {
7474
},
7575
],
7676
},
77+
{
78+
code: `{"${o.normalize("NFD")}":"NFD"}`,
79+
output: `{"${o.normalize("NFC")}":"NFD"}`,
80+
language: "json/json5",
81+
errors: [
82+
{
83+
messageId: "unnormalizedKey",
84+
data: { key: o.normalize("NFD") },
85+
line: 1,
86+
column: 2,
87+
endLine: 1,
88+
endColumn: 7,
89+
},
90+
],
91+
},
92+
{
93+
code: `{'${o.normalize("NFD")}':'NFD'}`,
94+
output: `{'${o.normalize("NFC")}':'NFD'}`,
95+
language: "json/json5",
96+
errors: [
97+
{
98+
messageId: "unnormalizedKey",
99+
data: { key: o.normalize("NFD") },
100+
line: 1,
101+
column: 2,
102+
endLine: 1,
103+
endColumn: 7,
104+
},
105+
],
106+
},
77107
{
78108
code: `{${o.normalize("NFD")}:"NFD"}`,
79109
output: `{${o.normalize("NFC")}:"NFD"}`,
@@ -120,6 +150,38 @@ ruleTester.run("no-unnormalized-keys", rule, {
120150
},
121151
],
122152
},
153+
{
154+
code: `{"${o.normalize("NFKC")}":"NFKC"}`,
155+
output: `{"${o.normalize("NFKD")}":"NFKC"}`,
156+
language: "json/json5",
157+
options: [{ form: "NFKD" }],
158+
errors: [
159+
{
160+
messageId: "unnormalizedKey",
161+
data: { key: o.normalize("NFKC") },
162+
line: 1,
163+
column: 2,
164+
endLine: 1,
165+
endColumn: 5,
166+
},
167+
],
168+
},
169+
{
170+
code: `{'${o.normalize("NFKC")}':"NFKC"}`,
171+
output: `{'${o.normalize("NFKD")}':"NFKC"}`,
172+
language: "json/json5",
173+
options: [{ form: "NFKD" }],
174+
errors: [
175+
{
176+
messageId: "unnormalizedKey",
177+
data: { key: o.normalize("NFKC") },
178+
line: 1,
179+
column: 2,
180+
endLine: 1,
181+
endColumn: 5,
182+
},
183+
],
184+
},
123185
{
124186
code: `{${o.normalize("NFKC")}:"NFKC"}`,
125187
output: `{${o.normalize("NFKD")}:"NFKC"}`,

0 commit comments

Comments
 (0)