From 5474d13278089fe8158d7a8a602353e015111901 Mon Sep 17 00:00:00 2001 From: Cameron Brill Date: Tue, 20 Feb 2024 11:58:21 -0500 Subject: [PATCH] wip --- .vscode/extensions.json | 6 +++++- .vscode/settings.json | 5 ++++- package.json | 5 +++-- src/__tests__/page.test.tsx | 15 +++++++++++++++ 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 src/__tests__/page.test.tsx diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 49d381a..17e87a6 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,6 +4,10 @@ "dbaeumer.vscode-eslint", "jota0222.multi-formatter", "esbenp.prettier-vscode", - "biomejs.biome" + "biomejs.biome", + "vitest.explorer", + "wallabyjs.wallaby-vscode", + "file-icons.file-icons", + "usernamehw.errorlens" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index a50c4d9..05d9d0f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,5 +15,8 @@ "editor.formatOnSave": true, "prettier.prettierPath": ".yarn/sdks/prettier/index.cjs", "biome_lsp.trace.server": "verbose", - "biome.lspBin": ".yarn/sdks/biome-lsp/bin/biome-lsp", + "vitest.watchOnStartup": true, + "vitest.showFailMessages": true, + "vitest.enable": true, + "vitest.commandLine": "yarn test -- ", } diff --git a/package.json b/package.json index 918021e..cc183dd 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,8 @@ "lint:fix": "yarn lint:fix:biome && yarn lint:fix:next", "format": "yarn _conc 'yarn:format:biome' 'yarn:format:imports'", "format:fix": "yarn format:fix:biome && yarn format:fix:imports", + "test": "vitest run", + "test:watch": "vitest watch", "build:ts": "next build", "build:ts:watch": "next dev --turbo", "build:scss": "yarn typed-scss-modules src --banner '// This file is automatically generated. Do not edit.'", @@ -65,7 +67,6 @@ "@trivago/prettier-plugin-sort-imports": "^4.3.0", "@types/node": "20.11.19", "@vitejs/plugin-react": "^4.2.1", - "@vitest/ui": "^1.3.0", "concurrently": "^8.2.2", "eslint": "^8.56.0", "eslint-config-next": "^14.1.0", @@ -79,4 +80,4 @@ "vitest": "^1.3.0" }, "packageManager": "yarn@4.1.0" -} +} \ No newline at end of file diff --git a/src/__tests__/page.test.tsx b/src/__tests__/page.test.tsx new file mode 100644 index 0000000..3bafbfc --- /dev/null +++ b/src/__tests__/page.test.tsx @@ -0,0 +1,15 @@ +import React from "react"; +import { expect, it, describe } from "vitest"; +import { render, screen } from "@testing-library/react"; + +import Home from "../app/page"; + +describe("Home component", () => { + it("should render the correct shortcut based on the OS", () => { + render(); + + const shortcut = screen.getByText(/⌘+K|ctrl+K/i); // Matches either "⌘+K" or "ctrl+K" + + expect(shortcut).toBeInTheDocument(); + }); +});