Throw if recorder writes to fixture twice
ericclemmons opened this issue · 2 comments
ericclemmons commented
If a fixture is being recorded twice with different payloads, then that's a sign that there's a bug in the recorder or program:
- Requesting
/me
with a cookie, but not settingusername
gets recorded as "all". - Requesting
/me
without a cookie, expecting a 403, but gets the previous user's data.
ericclemmons commented
This is easily reproducible with current tests via Jest:
jest --watch
- Toggle to
RERECORD
- The tests re-run.
As a solution, I think that the JestRecorderWatchPlugin
should revert back to REPLAY
after re-recording.
ericclemmons commented
const fetch = require("node-fetch");
describe("time", () => {
it("should stand still", async () => {
const res = await fetch("http://worldclockapi.com/api/json/pst/now");
expect(await res.json()).toMatchInlineSnapshot();
});
});