Skip to content

Commit 6c5883d

Browse files
authored
Move libs/api-mocks to top-level mock-api dir (#1976)
* move /app/test to /test * move libs/api-mocks to mock-api
1 parent 6de56b1 commit 6c5883d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+27
-55
lines changed

README.md

Lines changed: 2 additions & 2 deletions

app/components/form/fields/DateTimeRangePicker.spec.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ import { fireEvent, render, screen } from '@testing-library/react'
1010
import ResizeObserverPolyfill from 'resize-observer-polyfill'
1111
import { beforeAll, describe, expect, it, vi } from 'vitest'
1212

13-
import { clickByRole } from 'app/test/unit'
14-
1513
import { DateTimeRangePicker, type RangeKey } from './DateTimeRangePicker'
1614

15+
export function clickByRole(role: string, name: string) {
16+
const element = screen.getByRole(role, { name })
17+
fireEvent.click(element)
18+
}
19+
1720
const now = getNow(getLocalTimeZone())
1821

1922
function renderLastDay() {

app/test/unit/index.tsx

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/mock-api-differences.md

Lines changed: 4 additions & 5 deletions

libs/api/__tests__/hooks.spec.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ import { describe, expect, it, vi } from 'vitest'
1111

1212
import { project } from '@oxide/api-mocks'
1313

14-
import { overrideOnce } from 'app/test/unit'
15-
1614
import { useApiMutation, useApiQuery } from '..'
1715
import type { DiskCreate } from '../__generated__/Api'
16+
import { overrideOnce } from '../../../test/unit/server'
1817

1918
// because useApiQuery and useApiMutation are almost entirely typed wrappers
2019
// around React Query's useQuery and useMutation, these tests are mostly about

libs/api/__tests__/safety.spec.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,19 @@ const grepFiles = (s: string) =>
3333
.filter((f) => !/safety\.spec\.ts/.test(f)) // this file doesn't count
3434

3535
it('@oxide/api-mocks is only referenced in test files', () => {
36-
const files = grepFiles('api-mocks')
37-
expect(files).toMatchInlineSnapshot(`
36+
expect(grepFiles('api-mocks')).toMatchInlineSnapshot(`
3837
[
39-
"README.md",
4038
"app/msw-mock-api.ts",
41-
"app/test/e2e/instance-create.e2e.ts",
42-
"app/test/e2e/inventory.e2e.ts",
43-
"app/test/e2e/profile.e2e.ts",
44-
"app/test/e2e/project-access.e2e.ts",
45-
"app/test/e2e/silo-access.e2e.ts",
46-
"app/test/e2e/utils.ts",
47-
"app/test/unit/server.ts",
48-
"app/test/unit/setup.ts",
49-
"docs/mock-api-differences.md",
50-
"libs/api-mocks/msw/db.ts",
5139
"libs/api/__tests__/hooks.spec.tsx",
40+
"mock-api/msw/db.ts",
41+
"test/e2e/instance-create.e2e.ts",
42+
"test/e2e/inventory.e2e.ts",
43+
"test/e2e/profile.e2e.ts",
44+
"test/e2e/project-access.e2e.ts",
45+
"test/e2e/silo-access.e2e.ts",
46+
"test/e2e/utils.ts",
47+
"test/unit/server.ts",
48+
"test/unit/setup.ts",
5249
"tools/start_mock_api.ts",
5350
"tsconfig.json",
5451
]
@@ -66,8 +63,8 @@ const listFiles = (s: string) =>
6663
execSync(`git ls-files | grep "${s}"`).toString().trim().split('\n')
6764

6865
// avoid accidentally making an e2e file in the wrong place
69-
it('e2e tests are only in app/test/e2e', () => {
66+
it('e2e tests are only in test/e2e', () => {
7067
for (const file of listFiles('\\.e2e\\.')) {
71-
expect(file).toMatch(/^app\/test\/e2e/)
68+
expect(file).toMatch(/^test\/e2e/)
7269
}
7370
})
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)