From 934f11c43e77da2b563ec29bac523b8aedb7b8f9 Mon Sep 17 00:00:00 2001 From: Pol Gubau Amores Date: Tue, 19 Nov 2024 09:37:29 +0100 Subject: [PATCH] feat: Update CI pipeline to publish icons package and remove unused DarkThemeToggle tests --- .github/workflows/pipeline.yaml | 2 +- packages/ui/.turbo/turbo-build.log | 4 - packages/ui/src/components/Card/Card.spec.tsx | 82 ++----------------- .../DarkThemeToggle/DarkThemeToggle.spec.tsx | 22 ----- 4 files changed, 10 insertions(+), 100 deletions(-) delete mode 100644 packages/ui/src/components/DarkThemeToggle/DarkThemeToggle.spec.tsx diff --git a/.github/workflows/pipeline.yaml b/.github/workflows/pipeline.yaml index 45ddbd13..8827a5f3 100644 --- a/.github/workflows/pipeline.yaml +++ b/.github/workflows/pipeline.yaml @@ -138,7 +138,7 @@ jobs: if: github.ref == 'refs/heads/main' run: | echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc - cd packages/ui + cd packages/icons pnpm publish --no-git-checks env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/packages/ui/.turbo/turbo-build.log b/packages/ui/.turbo/turbo-build.log index 0e6be86a..8ac6e20f 100644 --- a/packages/ui/.turbo/turbo-build.log +++ b/packages/ui/.turbo/turbo-build.log @@ -6,7 +6,3 @@ > pol-ui@2.1.29 build:esm C:\Users\pol.gubau\dev\mine\ui\pol-ui\packages\ui > tsc -p tsconfig.lib.json --module esnext --declaration --outDir ./lib/esm - -> pol-ui@2.1.29 build:cjs C:\Users\pol.gubau\dev\mine\ui\pol-ui\packages\ui -> tsc -p tsconfig.lib.json - diff --git a/packages/ui/src/components/Card/Card.spec.tsx b/packages/ui/src/components/Card/Card.spec.tsx index 083971f1..95f6b156 100644 --- a/packages/ui/src/components/Card/Card.spec.tsx +++ b/packages/ui/src/components/Card/Card.spec.tsx @@ -1,80 +1,16 @@ -import { render, screen } from '@testing-library/react' -import { describe, expect, it } from 'vitest' -import { PoluiProvider, type CustomPoluiTheme } from '../PoluiProvider' -import { Card } from './Card' +import { render, screen } from "@testing-library/react" +import { describe, expect, it } from "vitest" -describe('Components / Card', () => { - describe('A11y', () => { - it('should allow `aria-label`', () => { - render() - - expect(card()).toHaveAccessibleName('My card') - }) - }) - - describe('Rendering', () => { - it('should render an `` given `href=".."`', () => { - render() - - expect(screen.getByRole('link')).toEqual(card()) - }) - }) +import { Card } from "./Card" - describe('Theme', () => { - it('should use `base` classes', () => { - const theme: CustomPoluiTheme = { - card: { - root: { - base: 'text-cyan-100', - }, - }, - } - render( - - - , - ) - - expect(card()).toHaveClass('text-cyan-100') - }) - - it('should use `children` classes', () => { - const theme: CustomPoluiTheme = { - card: { - root: { - children: 'text-cyan-900', - }, - }, - } - render( - - - Some content - - , - ) - const children = screen.getByLabelText('The content') - - expect(children.parentElement).toHaveClass('text-cyan-900') - }) - - it('should use `href` classes', () => { - const theme: CustomPoluiTheme = { - card: { - root: { - href: 'text-cyan-700', - }, - }, - } - render( - - My card - , - ) +describe("Components / Card", () => { + describe("A11y", () => { + it("should allow `aria-label`", () => { + render() - expect(card()).toHaveClass('text-cyan-700') + expect(card()).toHaveAccessibleName("My card") }) }) }) -const card = () => screen.getByTestId('ui-card') +const card = () => screen.getByTestId("ui-card") diff --git a/packages/ui/src/components/DarkThemeToggle/DarkThemeToggle.spec.tsx b/packages/ui/src/components/DarkThemeToggle/DarkThemeToggle.spec.tsx deleted file mode 100644 index 850052e6..00000000 --- a/packages/ui/src/components/DarkThemeToggle/DarkThemeToggle.spec.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { render, screen } from '@testing-library/react' -import userEvent from '@testing-library/user-event' -import { describe, expect, it } from 'vitest' -import { PoluiProvider } from '../PoluiProvider' -import { DarkThemeToggle } from './DarkThemeToggle' - -describe('Dark theme toggle', () => { - it('should toggle the theme when `Space` is pressed', async () => { - const user = userEvent.setup() - render( - - - , - ) - - await user.tab() - await user.keyboard('[Space]') - - expect(screen.queryByLabelText('Toggle dark mode')).toHaveAttribute('data-active', 'true') - expect(screen.queryByLabelText('Toggle dark mode')).toHaveAttribute('data-active', 'true') - }) -})