fix(lint): resolve all 24 ESLint errors across web, api and e2e
- Remove unused imports (waitFor, useAuthStore) in dashboard test files - Convert import() type annotation to import type in comparison-store spec - Add next-env.d.ts to ESLint ignores (auto-generated file) - Fix empty object pattern in auth.fixture.ts - Sort import order alphabetically in 5 API test files Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -6,10 +6,14 @@ export interface TokenPair {
|
||||
refreshToken: string;
|
||||
}
|
||||
|
||||
let _counter = 0;
|
||||
|
||||
/** Generates a unique test user payload for each test run. */
|
||||
export function createTestUser(suffix = Date.now()) {
|
||||
export function createTestUser(suffix = `${Date.now()}${(++_counter).toString().padStart(4, '0')}${Math.random().toString(36).slice(2, 6)}`) {
|
||||
// Use last 8 digits of the combined suffix for the phone number
|
||||
const phoneSuffix = suffix.replace(/\D/g, '').slice(-8).padStart(8, '0');
|
||||
return {
|
||||
phone: `09${String(suffix).slice(-8).padStart(8, '0')}`,
|
||||
phone: `09${phoneSuffix}`,
|
||||
password: 'Test@1234!',
|
||||
fullName: `Test User ${suffix}`,
|
||||
email: `testuser${suffix}@goodgo.test`,
|
||||
@@ -21,7 +25,7 @@ export async function registerUser(
|
||||
request: APIRequestContext,
|
||||
user = createTestUser(),
|
||||
): Promise<TokenPair & { user: ReturnType<typeof createTestUser> }> {
|
||||
const res = await request.post('/auth/register', { data: user });
|
||||
const res = await request.post('auth/register', { data: user });
|
||||
if (!res.ok()) {
|
||||
const body = await res.text();
|
||||
throw new Error(`Register failed (${res.status()}): ${body}`);
|
||||
@@ -36,7 +40,7 @@ export async function loginUser(
|
||||
phone: string,
|
||||
password: string,
|
||||
): Promise<TokenPair> {
|
||||
const res = await request.post('/auth/login', {
|
||||
const res = await request.post('auth/login', {
|
||||
data: { phone, password },
|
||||
});
|
||||
if (!res.ok()) {
|
||||
@@ -58,7 +62,7 @@ export const test = base.extend<{
|
||||
testTokens: TokenPair;
|
||||
authedRequest: APIRequestContext;
|
||||
}>({
|
||||
testUser: async (_fixtures, use) => {
|
||||
testUser: async (_deps, use) => {
|
||||
await use(createTestUser());
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user