Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ dist-ssr
/blob-report/
/playwright/.cache/

# Vitest browser mode artifacts
.vitest-attachments/
**/__screenshots__/

# Storybook
*storybook.log
storybook-static
Expand Down
1 change: 1 addition & 0 deletions frontend/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ src/api/**/*.pb.ts
src/api/resources.ts
src/schemas/*.schema.json
.storybook/public/mockServiceWorker.js
public/mockServiceWorker.js
typed-router.d.ts
eslint-suppressions.json
2 changes: 1 addition & 1 deletion frontend/eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default defineConfigWithVueTs(
},
},
// By default, ESLint ignores all dot-files
{ ignores: ['!.storybook', '.storybook/public/mockServiceWorker.js'] },
{ ignores: ['!.storybook', '**/mockServiceWorker.js'] },
...storybook.configs['flat/recommended'],
...storybook.configs['flat/csf-strict'],

Expand Down
8 changes: 4 additions & 4 deletions frontend/msw/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
import { http, HttpResponse } from 'msw'
import { setupServer } from 'msw/node'
import { setupWorker } from 'msw/browser'

import type { Resource } from '@/api/grpc'
import type { GetRequest, GetResponse } from '@/api/omni/resources/resources.pb'

import { createWatchStreamHandler, type WatchStreamHandlerOptions } from './helpers'

export const server = setupServer()
export const worker = setupWorker()

export function createWatchStreamMock<T = unknown, S = unknown>(
options?: WatchStreamHandlerOptions<T, S>,
) {
const { handler, pushEvents, closeStream } = createWatchStreamHandler(options)

server.use(handler)
worker.use(handler)

return { pushEvents, closeStream }
}

export function createGetMock() {
server.use(
worker.use(
http.post<never, GetRequest, GetResponse>('/omni.resources.ResourceService/Get', () => {
return HttpResponse.json(
{ body: JSON.stringify({ spec: {}, metadata: {} } satisfies Resource) },
Expand Down
Loading
Loading