finish CSS delivery and generated type remediation
This commit is contained in:
@@ -38,4 +38,39 @@ describe("syntax contract and security diagnostics", () => {
|
||||
expect(codes).toContain("WRN-SEC-STRING-TIMER");
|
||||
expect(codes).toContain("WRN-PERSIST-SENSITIVE");
|
||||
});
|
||||
|
||||
test.each([
|
||||
[
|
||||
"server output call",
|
||||
`component Bad { outputs { save() } functions { server function run(): void { output.save() } } view { <div></div> } }`,
|
||||
"WRN-OUTPUT-SERVER-CALL",
|
||||
],
|
||||
[
|
||||
"unknown output call",
|
||||
`component Bad { functions { client function run(): void { output.missing() } } view { <button @click="run()">Run</button> } }`,
|
||||
"WRN-OUTPUT-UNKNOWN",
|
||||
],
|
||||
[
|
||||
"server API in client function",
|
||||
`component Bad { functions { client function run(): void { process.cwd() } } view { <button @click="run()">Run</button> } }`,
|
||||
"WRN-CLIENT-SERVER-API",
|
||||
],
|
||||
[
|
||||
"browser API in server function",
|
||||
`component Bad { functions { server function run(): void { document.title = "bad" } } view { <div></div> } }`,
|
||||
"WRN-SERVER-BROWSER-API",
|
||||
],
|
||||
[
|
||||
"non-serializable shared state",
|
||||
`global store Bad { state { values: unknown = new Map() } }`,
|
||||
"WRN-STATE-NON-SERIALIZABLE",
|
||||
],
|
||||
[
|
||||
"unknown persisted state",
|
||||
`global store Bad { state { value: string = "x" } persist { storage = "local" include = ["missing"] version = 1 } }`,
|
||||
"WRN-PERSIST-UNKNOWN-FIELD",
|
||||
],
|
||||
])("diagnoses %s", (_name, source, expectedCode) => {
|
||||
expect(diagnose(source).map((diagnostic) => diagnostic.code)).toContain(expectedCode);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user