Skip to content

Commit 52a0a4c

Browse files
committed
test(observability-map): stop the directive-prologue test passing on an unapplied mutation
1 parent 0fdf03c commit 52a0a4c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

internal-packages/observability-map/src/mutationCorpus.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,12 @@ describe("a preserving mutation preserves what the route does", () => {
242242
it("leaves a directive prologue alone when merging comma expressions", () => {
243243
const merge = MUTATIONS.find((m) => m.id === "merge-comma-expressions")!;
244244
const result = merge.apply("api.v1.a.tsx", '"use client";\nfoo();\nbar();\n');
245-
expect(result?.source ?? "").not.toContain('"use client",');
245+
// The first two assertions carry the test. Without them `?? ""` let it pass when the mutation
246+
// did not apply at all, and it would still have passed had the mutation deleted the directive.
247+
expect(result).toBeDefined();
248+
expect(result?.source).toContain('"use client";');
249+
expect(result?.source).not.toContain('"use client",');
250+
expect(result?.source).toContain("foo(), bar()");
246251
});
247252
});
248253

0 commit comments

Comments
 (0)