test: use testids instead of text queries for unit tests (#5)
CI / Generate Certificates (push) Successful in 28s
CI / Frontend CI (push) Successful in 1m3s
CI / E2E Tests (push) Has been cancelled
CI / Backend CI (push) Has been cancelled

Co-authored-by: me <ramvignesh-b@github.com>
Reviewed-on: #5
This commit was merged in pull request #5.
This commit is contained in:
2026-05-07 23:54:12 +00:00
parent 7e53229308
commit d625cbb1fb
12 changed files with 220 additions and 223 deletions
+6 -6
View File
@@ -48,10 +48,10 @@ describe("Drawer Page", () => {
</MemoryRouter>,
);
expect(screen.getByText(/Drafts/i)).toBeInTheDocument();
expect(screen.getAllByText(/Kept/i).length).toBeGreaterThanOrEqual(1);
expect(screen.getByText(/Vault/i)).toBeInTheDocument();
expect(screen.getByText(/This drawer remains silent/i)).toBeInTheDocument();
expect(screen.getByTestId("drawer-section-drafts")).toBeInTheDocument();
expect(screen.getAllByTestId("drawer-section-title").length).toBeGreaterThanOrEqual(1);
expect(screen.getByTestId("drawer-section-vault")).toBeInTheDocument();
expect(screen.getByTestId("empty-drawer-message-drafts")).toBeInTheDocument();
});
it("renders the loading state", () => {
@@ -70,7 +70,7 @@ describe("Drawer Page", () => {
</MemoryRouter>,
);
expect(screen.getByText(/Opening your cabinet/i)).toBeInTheDocument();
expect(screen.getByTestId("drawer-loading-state")).toBeInTheDocument();
});
it("renders the authentication required modal when api requires auth", () => {
@@ -89,7 +89,7 @@ describe("Drawer Page", () => {
</MemoryRouter>,
);
expect(screen.getByText(/You've been away a while./i)).toBeInTheDocument();
expect(screen.getByTestId("passkey-modal-title")).toBeInTheDocument();
expect(screen.getByPlaceholderText(/password/i)).toBeInTheDocument();
});