-
Notifications
You must be signed in to change notification settings - Fork 0
ci: permitir disparo manual do build de front-end #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
00fa796
b2b2d54
55e62ea
fe0b5e0
3fdf980
0f95cc8
79cb765
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,7 @@ on: | |||||
| branches: [main, develop] | ||||||
| pull_request: | ||||||
| branches: [main, develop] | ||||||
| workflow_dispatch: | ||||||
|
|
||||||
| env: | ||||||
| NODE_VERSION: '20' | ||||||
|
|
@@ -82,7 +83,7 @@ jobs: | |||||
| run: npm install --no-audit --no-fund | ||||||
|
|
||||||
| - name: 🧪 Run Vitest | ||||||
| run: npm run test -- --coverage --reporter=verbose | ||||||
| run: npm run test -- --reporter=verbose | ||||||
|
Comment on lines
85
to
+86
|
||||||
| env: | ||||||
| CI: true | ||||||
|
|
||||||
|
|
@@ -93,6 +94,7 @@ jobs: | |||||
| name: coverage-report | ||||||
| path: coverage/ | ||||||
| retention-days: 7 | ||||||
| if-no-files-found: ignore | ||||||
|
|
||||||
| # =========================================== | ||||||
| # JOB 3: Deno Edge Function Tests | ||||||
|
|
@@ -127,7 +129,7 @@ jobs: | |||||
| build: | ||||||
| name: 🏗️ Build | ||||||
| runs-on: ubuntu-latest | ||||||
| needs: [lint-and-typecheck, test, deno-edge-tests] | ||||||
| needs: [lint-and-typecheck, deno-edge-tests] | ||||||
|
||||||
| needs: [lint-and-typecheck, deno-edge-tests] | |
| needs: [lint-and-typecheck, test, deno-edge-tests] |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,3 @@ | ||||||||||||||||||||||||||||||||||||||
| // @ts-nocheck | ||||||||||||||||||||||||||||||||||||||
| import { describe, it, expect, vi, beforeEach } from 'vitest'; | ||||||||||||||||||||||||||||||||||||||
| import { renderHook, act, waitFor } from '@testing-library/react'; | ||||||||||||||||||||||||||||||||||||||
| import React from 'react'; | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -8,14 +7,14 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | |||||||||||||||||||||||||||||||||||||
| const mockInvoke = vi.fn(); | ||||||||||||||||||||||||||||||||||||||
| vi.mock('@/integrations/supabase/client', () => ({ | ||||||||||||||||||||||||||||||||||||||
| supabase: { | ||||||||||||||||||||||||||||||||||||||
| functions: { invoke: (...args: any[]) => mockInvoke(...args) }, | ||||||||||||||||||||||||||||||||||||||
| functions: { invoke: (...args: unknown[]) => mockInvoke(...args) }, | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| vi.mock('@/lib/logger', () => ({ | ||||||||||||||||||||||||||||||||||||||
| createLogger: () => ({ debug: vi.fn(), info: vi.fn(), error: vi.fn(), warn: vi.fn() }), | ||||||||||||||||||||||||||||||||||||||
| getLogger: () => ({ debug: vi.fn(), info: vi.fn(), error: vi.fn(), warn: vi.fn() }), | ||||||||||||||||||||||||||||||||||||||
| log: { debug: vi.fn(), info: vi.fn(), error: vi.fn() }, | ||||||||||||||||||||||||||||||||||||||
| log: { debug: vi.fn(), info: vi.fn(), error: vi.fn(), warn: vi.fn() }, | ||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| import { useExternalCatalog, ExternalProduct, ExternalCategory, ExternalSupplier, ExternalProductVariant, CatalogFilters } from '@/hooks/useExternalCatalog'; | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -103,7 +102,7 @@ function setupMockInvoke(responses: Record<string, any>) { | |||||||||||||||||||||||||||||||||||||
| list_suppliers: { data: [] }, | ||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||
| const merged = { ...defaults, ...responses }; | ||||||||||||||||||||||||||||||||||||||
| mockInvoke.mockImplementation(async (fnName: string, opts: any) => { | ||||||||||||||||||||||||||||||||||||||
| mockInvoke.mockImplementation(async (fnName: string, opts: unknown) => { | ||||||||||||||||||||||||||||||||||||||
| const action = opts?.body?.action; | ||||||||||||||||||||||||||||||||||||||
| if (merged[action]) { | ||||||||||||||||||||||||||||||||||||||
| return { data: merged[action], error: null }; | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+105
to
108
|
||||||||||||||||||||||||||||||||||||||
|
|
@@ -166,7 +165,7 @@ describe('useExternalCatalog', () => { | |||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| it('sets loading state during fetch', async () => { | ||||||||||||||||||||||||||||||||||||||
| let resolvePromise: (v: any) => void; | ||||||||||||||||||||||||||||||||||||||
| let resolvePromise: (v: unknown) => void; | ||||||||||||||||||||||||||||||||||||||
| mockInvoke.mockReturnValue(new Promise(r => { resolvePromise = r; })); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| const { result } = renderHook(() => useExternalCatalog(), { wrapper: createWrapper() }); | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -568,7 +567,7 @@ describe('Edge Function Contract', () => { | |||||||||||||||||||||||||||||||||||||
| await waitFor(() => { | ||||||||||||||||||||||||||||||||||||||
| expect(mockInvoke).toHaveBeenCalled(); | ||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
| const productCall = mockInvoke.mock.calls.find((c: any) => c[1]?.body?.action === 'list_products'); | ||||||||||||||||||||||||||||||||||||||
| const productCall = mockInvoke.mock.calls.find((c: unknown) => c[1]?.body?.action === 'list_products'); | ||||||||||||||||||||||||||||||||||||||
| expect(productCall).toBeTruthy(); | ||||||||||||||||||||||||||||||||||||||
| expect(productCall[1].body.action).toBe('list_products'); | ||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+570
to
573
|
||||||||||||||||||||||||||||||||||||||
|
|
@@ -579,7 +578,7 @@ describe('Edge Function Contract', () => { | |||||||||||||||||||||||||||||||||||||
| const { result } = renderHook(() => useExternalCatalog(), { wrapper: createWrapper() }); | ||||||||||||||||||||||||||||||||||||||
| await act(async () => { await result.current.fetchProduct('p1'); }); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| const call = mockInvoke.mock.calls.find((c: any) => c[1]?.body?.action === 'get_product'); | ||||||||||||||||||||||||||||||||||||||
| const call = mockInvoke.mock.calls.find((c: unknown) => c[1]?.body?.action === 'get_product'); | ||||||||||||||||||||||||||||||||||||||
| expect(call).toBeTruthy(); | ||||||||||||||||||||||||||||||||||||||
| expect(call[1].body.action).toBe('get_product'); | ||||||||||||||||||||||||||||||||||||||
| expect(call[1].body.params.product_id).toBe('p1'); | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -592,7 +591,7 @@ describe('Edge Function Contract', () => { | |||||||||||||||||||||||||||||||||||||
| act(() => { result.current.fetchCategories(); }); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| await waitFor(() => { | ||||||||||||||||||||||||||||||||||||||
| const catCall = mockInvoke.mock.calls.find((c: any) => c[1]?.body?.action === 'list_categories'); | ||||||||||||||||||||||||||||||||||||||
| const catCall = mockInvoke.mock.calls.find((c: unknown) => c[1]?.body?.action === 'list_categories'); | ||||||||||||||||||||||||||||||||||||||
| expect(catCall).toBeTruthy(); | ||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+594
to
596
|
||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -604,7 +603,7 @@ describe('Edge Function Contract', () => { | |||||||||||||||||||||||||||||||||||||
| act(() => { result.current.fetchSuppliers(); }); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| await waitFor(() => { | ||||||||||||||||||||||||||||||||||||||
| const supCall = mockInvoke.mock.calls.find((c: any) => c[1]?.body?.action === 'list_suppliers'); | ||||||||||||||||||||||||||||||||||||||
| const supCall = mockInvoke.mock.calls.find((c: unknown) => c[1]?.body?.action === 'list_suppliers'); | ||||||||||||||||||||||||||||||||||||||
| expect(supCall).toBeTruthy(); | ||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+606
to
608
|
||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -699,7 +698,7 @@ describe('Data Integrity', () => { | |||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| const { result } = renderHook(() => useExternalCatalog(), { wrapper: createWrapper() }); | ||||||||||||||||||||||||||||||||||||||
| let fetched: any; | ||||||||||||||||||||||||||||||||||||||
| let fetched: unknown; | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
| await act(async () => { | ||||||||||||||||||||||||||||||||||||||
| fetched = await result.current.fetchProduct('p1'); | ||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -803,7 +802,7 @@ describe('Edge Cases & Boundaries', () => { | |||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| await waitFor(() => { | ||||||||||||||||||||||||||||||||||||||
| const call = mockInvoke.mock.calls.find((c: any) => c[1]?.body?.action === 'list_products' && c[1]?.body?.params?.search); | ||||||||||||||||||||||||||||||||||||||
| const call = mockInvoke.mock.calls.find((c: unknown) => c[1]?.body?.action === 'list_products' && c[1]?.body?.params?.search); | ||||||||||||||||||||||||||||||||||||||
| expect(call).toBeTruthy(); | ||||||||||||||||||||||||||||||||||||||
| expect(call[1].body.params.search).toBe("caneta d'água & %"); | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+805
to
807
|
||||||||||||||||||||||||||||||||||||||
| const call = mockInvoke.mock.calls.find((c: unknown) => c[1]?.body?.action === 'list_products' && c[1]?.body?.params?.search); | |
| expect(call).toBeTruthy(); | |
| expect(call[1].body.params.search).toBe("caneta d'água & %"); | |
| type InvokeCall = [ | |
| string, | |
| { | |
| body?: { | |
| action?: string; | |
| params?: { | |
| search?: string; | |
| }; | |
| }; | |
| }?, | |
| ]; | |
| const calls = mockInvoke.mock.calls as InvokeCall[]; | |
| const call = calls.find((c) => c[1]?.body?.action === 'list_products' && c[1]?.body?.params?.search); | |
| expect(call).toBeTruthy(); | |
| expect(call![1]?.body?.params?.search).toBe("caneta d'água & %"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Este PR está descrito como uma mudança para habilitar
workflow_dispatch, mas também altera comportamento do pipeline (cobertura desativada / dependências entre jobs). Se for intencional, atualizar a descrição; se não, separar as mudanças para manter a PR focada.