fix: synchronize mounted component props
This commit is contained in:
1 parent
56cde5aaf8
commit
53b9947ef9
11 files changed
+159
-10
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { detectMutations } from "../src/mutation.ts";
|
||||
|
||||
test("detectMutations reports mutations whose behaviour changes", async () => {
|
||||
const report = await detectMutations({
|
||||
baseline: (amount: number) => amount,
|
||||
mutations: [
|
||||
{ name: "invert sign", value: (amount: number) => -amount },
|
||||
{ name: "drop amount", value: () => 0 },
|
||||
],
|
||||
exercise: (adjust) => adjust(7),
|
||||
});
|
||||
expect(report.killed).toEqual(["invert sign", "drop amount"]);
|
||||
expect(report.survived).toEqual([]);
|
||||
});
|
||||
|
||||
test("detectMutations fails with the names of surviving mutations", async () => {
|
||||
await expect(
|
||||
detectMutations({
|
||||
baseline: (amount: number) => amount,
|
||||
mutations: [{ name: "wrong implementation", value: (amount: number) => amount }],
|
||||
exercise: (adjust) => adjust(7),
|
||||
}),
|
||||
).rejects.toThrow(/WRN-MUTATION-SURVIVED: wrong implementation/);
|
||||
});
|
||||
|
||||
test("detectMutations accepts structured observations through an equivalence function", async () => {
|
||||
const report = await detectMutations({
|
||||
baseline: { status: 200 },
|
||||
mutations: [{ name: "deny request", value: { status: 403 } }],
|
||||
exercise: async (response) => ({ ...response, volatile: crypto.randomUUID() }),
|
||||
equivalent: (left, right) => left.status === right.status,
|
||||
});
|
||||
expect(report.killed).toEqual(["deny request"]);
|
||||
});
|
||||
Reference in new issue
Block a user