chore: improve cypress factory types
This commit is contained in:
parent
c3f3a23fe5
commit
59aca9fd5d
|
|
@ -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<ProjectAttributes, 'id'> & { 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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 ?? {}),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<UserAttributes, 'id' | 'password'> & { id: string; password?: string } {
|
||||
static factory() {
|
||||
const now = new Date()
|
||||
|
||||
return {
|
||||
|
|
@ -30,4 +30,4 @@ export class UserFactory extends Factory {
|
|||
updated: now.toISOString(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue