From 59aca9fd5dc016509c17228b64a3f5e7b0757064 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 3 Jun 2025 18:23:07 +0200 Subject: [PATCH] chore: improve cypress factory types --- frontend/cypress/factories/project.ts | 6 +++--- frontend/cypress/factories/token.ts | 4 ++-- frontend/cypress/factories/user.ts | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/cypress/factories/project.ts b/frontend/cypress/factories/project.ts index 8530dc1dd..ce31d2308 100644 --- a/frontend/cypress/factories/project.ts +++ b/frontend/cypress/factories/project.ts @@ -2,7 +2,7 @@ import {Factory} from '../support/factory' import {faker} from '@faker-js/faker' export interface ProjectAttributes { - id: number | string; // Allow string for '{increment}' + id: number | '{increment}'; title: string; owner_id: number; created: string; @@ -12,7 +12,7 @@ export interface ProjectAttributes { export class ProjectFactory extends Factory { static table = 'projects' - static factory(): Omit & { id: string } { // id is '{increment}' before seeding + static factory() { const now = new Date() return { @@ -23,4 +23,4 @@ export class ProjectFactory extends Factory { updated: now.toISOString(), } } -} \ No newline at end of file +} diff --git a/frontend/cypress/factories/token.ts b/frontend/cypress/factories/token.ts index a51692fd0..e15979654 100644 --- a/frontend/cypress/factories/token.ts +++ b/frontend/cypress/factories/token.ts @@ -2,7 +2,7 @@ import {faker} from '@faker-js/faker' import {Factory} from '../support/factory' export interface TokenAttributes { - id: number | string; // Allow string for '{increment}' + id: number | '{increment}'; user_id: number; token: string; kind: number; @@ -26,4 +26,4 @@ export class TokenFactory extends Factory { ...(attrs ?? {}), } } -} \ No newline at end of file +} diff --git a/frontend/cypress/factories/user.ts b/frontend/cypress/factories/user.ts index a685e24ac..e07ba9f95 100644 --- a/frontend/cypress/factories/user.ts +++ b/frontend/cypress/factories/user.ts @@ -3,7 +3,7 @@ import {faker} from '@faker-js/faker' import {Factory} from '../support/factory' export interface UserAttributes { - id: number | string; + id: number | '{increment}'; username: string; password?: string; status: number; @@ -16,7 +16,7 @@ export interface UserAttributes { export class UserFactory extends Factory { static table = 'users' - static factory(): Omit & { id: string; password?: string } { + static factory() { const now = new Date() return { @@ -30,4 +30,4 @@ export class UserFactory extends Factory { updated: now.toISOString(), } } -} \ No newline at end of file +}