fix: unit testy selhávaly v CI kvůli MOCK_DATA=true z workflow env
CI / Generate TypeScript types (push) Successful in 11s
CI / Generate TypeScript types (pull_request) Successful in 10s
CI / Server unit tests (push) Successful in 27s
CI / Build server (push) Successful in 24s
CI / Server unit tests (pull_request) Successful in 19s
CI / Build client (push) Successful in 32s
CI / Build server (pull_request) Successful in 26s
CI / Build client (pull_request) Successful in 31s
CI / Playwright E2E tests (push) Successful in 1m17s
CI / Build and push Docker image (push) Has been skipped
CI / Playwright E2E tests (pull_request) Successful in 1m10s
CI / Build and push Docker image (pull_request) Has been skipped
CI / Notify (push) Successful in 2s
CI / Notify (pull_request) Has been skipped
CI / Generate TypeScript types (push) Successful in 11s
CI / Generate TypeScript types (pull_request) Successful in 10s
CI / Server unit tests (push) Successful in 27s
CI / Build server (push) Successful in 24s
CI / Server unit tests (pull_request) Successful in 19s
CI / Build client (push) Successful in 32s
CI / Build server (pull_request) Successful in 26s
CI / Build client (pull_request) Successful in 31s
CI / Playwright E2E tests (push) Successful in 1m17s
CI / Build and push Docker image (push) Has been skipped
CI / Playwright E2E tests (pull_request) Successful in 1m10s
CI / Build and push Docker image (pull_request) Has been skipped
CI / Notify (push) Successful in 2s
CI / Notify (pull_request) Has been skipped
setupEnv.ts nyní explicitně ruší MOCK_DATA, aby getToday() vracelo skutečné datum i když CI job nastavuje MOCK_DATA=true. seedPizzaDay používá getToday() místo new Date() pro konzistenci s pizza funkcemi.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { resetMemoryStorage } from '../storage/memory';
|
import { resetMemoryStorage } from '../storage/memory';
|
||||||
import getStorage from '../storage';
|
import getStorage from '../storage';
|
||||||
import { formatDate } from '../utils';
|
import { formatDate } from '../utils';
|
||||||
|
import { getToday } from '../service';
|
||||||
import {
|
import {
|
||||||
createPizzaDay,
|
createPizzaDay,
|
||||||
deletePizzaDay,
|
deletePizzaDay,
|
||||||
@@ -28,7 +29,6 @@ jest.mock('../chefie', () => ({
|
|||||||
downloadSalaty: jest.fn().mockResolvedValue([]),
|
downloadSalaty: jest.fn().mockResolvedValue([]),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const today = formatDate(new Date());
|
|
||||||
const CREATOR = 'kreator';
|
const CREATOR = 'kreator';
|
||||||
const USER = 'uzivatel';
|
const USER = 'uzivatel';
|
||||||
|
|
||||||
@@ -38,6 +38,7 @@ const SIZE_L = { varId: 2, size: '35cm', price: 219, boxPrice: 15, pizzaPrice: 2
|
|||||||
const SIZE: any = { varId: 10, size: 'střední', price: 150 };
|
const SIZE: any = { varId: 10, size: 'střední', price: 150 };
|
||||||
|
|
||||||
async function seedPizzaDay(state: PizzaDayState = PizzaDayState.CREATED): Promise<void> {
|
async function seedPizzaDay(state: PizzaDayState = PizzaDayState.CREATED): Promise<void> {
|
||||||
|
const today = formatDate(getToday());
|
||||||
const storage = getStorage();
|
const storage = getStorage();
|
||||||
const data: ClientData = {
|
const data: ClientData = {
|
||||||
todayDayIndex: 0,
|
todayDayIndex: 0,
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ process.env.NODE_ENV = 'test';
|
|||||||
process.env.STORAGE = 'memory';
|
process.env.STORAGE = 'memory';
|
||||||
process.env.JWT_SECRET = 'test-jwt-secret-ktery-ma-alespon-32-znaku';
|
process.env.JWT_SECRET = 'test-jwt-secret-ktery-ma-alespon-32-znaku';
|
||||||
process.env.LOGOUT_URL = 'http://localhost/logout';
|
process.env.LOGOUT_URL = 'http://localhost/logout';
|
||||||
|
delete process.env.MOCK_DATA;
|
||||||
|
|||||||
Reference in New Issue
Block a user