Skip to content

Commit f6feee7

Browse files
committed
add test: programmatic api works
1 parent c02c6a2 commit f6feee7

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`programmatic api works 1`] = `
4+
{
5+
"script": "function(){#4s.scripts.trust()}",
6+
"warnings": [],
7+
}
8+
`;

src/processScript/index.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -450,11 +450,10 @@ if (import.meta.vitest) {
450450
})
451451
}
452452

453-
test(`reassigning const variable`, () => {
454-
const reassignmentTestSource = `export default () => { const i = 0; i = 1; }`
455-
456-
expect(async (): Promise<any> => await processScript(reassignmentTestSource, { scriptName: true, minify: false }))
457-
.rejects
458-
.toThrowError(`Reassignment to const variable i is not allowed!`)
453+
test(`programmatic api works`, async () => {
454+
const source = `function () { #fs.scripts.trust() }`
455+
const processedScript = await processScript(source, { scriptName: true })
456+
457+
expect(processedScript).toMatchSnapshot()
459458
})
460459
}

0 commit comments

Comments
 (0)