diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..239097c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn + + - name: Enable Corepack + run: corepack enable + + - name: Install dependencies + run: yarn install --immutable + + - name: Test + run: yarn test:ci + + - name: Lint + run: yarn lint + + - name: Build + run: yarn build diff --git a/test/heuristics.spec.tsx b/test/heuristics.spec.tsx index 2dfc904..e716f1f 100644 --- a/test/heuristics.spec.tsx +++ b/test/heuristics.spec.tsx @@ -16,6 +16,14 @@ const getStats = (numbers: number[]) => ({ max: max(numbers), }); +const mockSeededRandom = (seed: number) => { + let state = seed; + return jest.spyOn(Math, "random").mockImplementation(() => { + state = (state * 16807) % 2147483647; + return (state - 1) / 2147483646; + }); +}; + const roundsToString = (rounds: Round[]) => rounds .map( diff --git a/yarn.lock b/yarn.lock index 39649f6..38b3c70 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8486,6 +8486,42 @@ __metadata: languageName: node linkType: hard +"jumbled-doubles-enhanced@workspace:.": + version: 0.0.0-use.local + resolution: "jumbled-doubles-enhanced@workspace:." + dependencies: + "@nextui-org/react": ^2.2.9 + "@testing-library/jest-dom": ^5.16.5 + "@testing-library/react": ^13.4.0 + "@testing-library/user-event": ^14.4.3 + "@types/jest": ^29.2.5 + "@types/lodash": ^4.14.202 + "@types/node": 18.11.18 + "@types/react": 18.0.26 + "@types/react-dom": 18.0.10 + "@types/uuid": ^9.0.0 + autoprefixer: ^10.4.15 + circletype: ^2.3.0 + clsx: ^2.1.0 + eslint: 8.30.0 + eslint-config-next: 13.1.1 + framer-motion: ^10.16.4 + jest: ^29.3.1 + jest-environment-jsdom: ^29.3.1 + lodash: ^4.17.21 + next: ^13.4.8 + next-pwa: ^5.6.0 + postcss: ^8.4.29 + react: 18.2.0 + react-dom: 18.2.0 + react-iconly: ^2.2.5 + tailwind-variants: ^0.1.20 + tailwindcss: ^3.4.0 + typescript: 4.9.4 + uuid: ^9.0.0 + languageName: unknown + linkType: soft + "kleur@npm:^3.0.3": version: 3.0.3 resolution: "kleur@npm:3.0.3" @@ -9419,42 +9455,6 @@ __metadata: languageName: node linkType: hard -"pickleball-shuffler@workspace:.": - version: 0.0.0-use.local - resolution: "pickleball-shuffler@workspace:." - dependencies: - "@nextui-org/react": ^2.2.9 - "@testing-library/jest-dom": ^5.16.5 - "@testing-library/react": ^13.4.0 - "@testing-library/user-event": ^14.4.3 - "@types/jest": ^29.2.5 - "@types/lodash": ^4.14.202 - "@types/node": 18.11.18 - "@types/react": 18.0.26 - "@types/react-dom": 18.0.10 - "@types/uuid": ^9.0.0 - autoprefixer: ^10.4.15 - circletype: ^2.3.0 - clsx: ^2.1.0 - eslint: 8.30.0 - eslint-config-next: 13.1.1 - framer-motion: ^10.16.4 - jest: ^29.3.1 - jest-environment-jsdom: ^29.3.1 - lodash: ^4.17.21 - next: ^13.4.8 - next-pwa: ^5.6.0 - postcss: ^8.4.29 - react: 18.2.0 - react-dom: 18.2.0 - react-iconly: ^2.2.5 - tailwind-variants: ^0.1.20 - tailwindcss: ^3.4.0 - typescript: 4.9.4 - uuid: ^9.0.0 - languageName: unknown - linkType: soft - "picocolors@npm:^1.0.0": version: 1.0.0 resolution: "picocolors@npm:1.0.0"