release: WRNexusJS 0.6.0
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { migrateV060WrnSource } from "../src/update.ts";
|
||||
|
||||
const report = () => ({
|
||||
changedAutomatically: [],
|
||||
needsReview: [],
|
||||
unresolvedImports: [],
|
||||
ambiguousFunctions: [],
|
||||
legacyOutputPayloads: [],
|
||||
parseFailures: [],
|
||||
});
|
||||
|
||||
describe("v0.6 source migration", () => {
|
||||
test("converts legacy outputs and remains idempotent", () => {
|
||||
const input = `component Demo {
|
||||
props {
|
||||
@event confirm = function
|
||||
}
|
||||
functions {
|
||||
function confirm() {
|
||||
$emit("confirm", { ok: true })
|
||||
}
|
||||
}
|
||||
view { <button @click='confirm()'>Confirm</button> }
|
||||
}`;
|
||||
const first = migrateV060WrnSource(input, report(), "Demo.wrn");
|
||||
const second = migrateV060WrnSource(first, report(), "Demo.wrn");
|
||||
expect(first).toContain("outputs {");
|
||||
expect(first).toContain("confirm(payload: unknown)");
|
||||
expect(first).toContain("output.confirm({ ok: true })");
|
||||
expect(second).toBe(first);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user