Skip to content

Commit 1469c51

Browse files
committed
Add some comments to counter.spec.ts
1 parent fcd5f82 commit 1469c51

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/counter.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ const { COUNTER } = getMiniflareBindings();
22
const id = COUNTER.newUniqueId();
33
const stub = COUNTER.get(id);
44

5+
// Note this is beforeAll, not beforeEach, yet each test still has isolated storage.
6+
// See https://v2.miniflare.dev/jest.html#isolated-storage for more details.
57
beforeAll(async () => {
68
const storage = await getMiniflareDurableObjectStorage(id);
7-
storage.put("count", 5);
9+
await storage.put("count", 5);
810
});
911

1012
test("should increment count", async () => {
@@ -14,6 +16,7 @@ test("should increment count", async () => {
1416

1517
test("should decrement count", async () => {
1618
const res = await stub.fetch(new Request("http://localhost/decrement"));
19+
// Note that the increment from above was automatically "undone", as we expect 4 not 5
1720
expect(await res.text()).toContain("⬇️ 4");
1821
});
1922

0 commit comments

Comments
 (0)