Skip to content

Commit

Permalink
test: bail on setItem when item itself exceeds maxChunks
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronshaf committed Nov 24, 2024
1 parent e5c1d47 commit 33ca60d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/idb-cache-app/tests/test-6.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { test, expect } from "@playwright/test";

test("bail on setItem when item itself exceeds maxChunks", async ({ page }) => {
await page.goto("http://localhost:3000/#size=32");
await page.getByTestId("reset-cacheKey").click();
await page.getByTestId("clear-button").click();
await page.getByTestId("count-button").click();
await expect(page.getByTestId("count-value")).toContainText("0");
await page.getByTestId("max-chunks-input").click();
await page.getByTestId("max-chunks-input").press("ControlOrMeta+a");
await page.getByTestId("max-chunks-input").fill("5");
await page.getByTestId("item-size-input").click();
await page.getByTestId("item-size-input").press("ControlOrMeta+a");
await page.getByTestId("item-size-input").fill("3");
await page.goto("http://localhost:3000/#size=3");
await page.getByTestId("item-size-input").fill("32");
await page.goto("http://localhost:3000/#size=32");
await page.getByTestId("item-size-input").fill("320");
await page.goto("http://localhost:3000/#size=320");
await page.getByTestId("item-size-input").fill("3200");
await page.goto("http://localhost:3000/#size=3200");
await page.getByTestId("set-item-button").click();
await expect(page.getByTestId("hash1").locator("span")).toContainText(
"------"
);
await page.getByTestId("count-button").click();
await expect(page.getByTestId("count-value")).toContainText("0");
await page.getByTestId("get-item-button").click();
await expect(page.getByTestId("hash2").locator("span")).toContainText(
"------"
);
});

0 comments on commit 33ca60d

Please sign in to comment.