Diffinery

homeflare/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

Test: don't depend on the order of two contact messages sent in the same millisecond

Both rows can get the same created_at, and then their random ids order them, so the test failed about half the time on fast runners (Unit tests (1/2) on this pull request).
Alan Kernel authored 1 parent e27e2a2commit 6d0b1499f43193979af72bef19466e313eb1e1baBrowse files
1 file changed+5−4
modifiedapps/diffinery/test/unit/contact.test.ts+5−4View file
@@ -157,10 +157,11 @@
157157 await submitMessage(env, audit, input("[email protected]", { message: "Second message, about another." }), null, "203.0.113.9");
158158 expect(rows(DB)).toHaveLength(2);
159159 await confirmMessage(env, audit, tokenOf(queued[1]));
160- expect(rows(DB).map((r) => [r.message, r.state])).toEqual([
161- ["First message, about one thing.", "unconfirmed"],
162- ["Second message, about another.", "new"],
163- ]);
160+ // Both can have the same created_at millisecond, and then the random id orders them.
161+ expect(Object.fromEntries(rows(DB).map((r) => [r.message, r.state]))).toEqual({
162+ "First message, about one thing.": "unconfirmed",
163+ "Second message, about another.": "new",
164+ });
164165 });
165166
166167 it("limits one network, one address and the whole form per day, quietly past the last two", async () => {