57 lines
1.2 KiB
TypeScript
57 lines
1.2 KiB
TypeScript
import type { MeResponse } from '../../src/api/client'
|
|
|
|
export function createMeFixture(overrides?: {
|
|
xp?: number
|
|
coins?: number
|
|
totalStars?: number
|
|
name?: string
|
|
}): MeResponse {
|
|
const xp = overrides?.xp ?? 10
|
|
const coins = overrides?.coins ?? 100
|
|
const totalStars = overrides?.totalStars ?? 0
|
|
return {
|
|
user: {
|
|
id: 'user-1',
|
|
name: overrides?.name ?? 'Test User',
|
|
level: 1,
|
|
xp,
|
|
maxXp: 100,
|
|
coins,
|
|
missionProgress: 0,
|
|
missionTarget: 3,
|
|
},
|
|
wallet: { cash: 500, goldGrams: 0 },
|
|
progress: {
|
|
completedChallenges: [],
|
|
completedLessons: [],
|
|
completedGames: [],
|
|
claimedRewards: [],
|
|
ownedItems: [],
|
|
mapLevels: [
|
|
{
|
|
id: 1,
|
|
title: 'L1',
|
|
stars: totalStars > 0 ? 3 : 0,
|
|
maxStars: 3,
|
|
status: totalStars > 0 ? 'completed' : 'current',
|
|
x: 50,
|
|
y: 50,
|
|
},
|
|
],
|
|
totalStars,
|
|
maxStars: 18,
|
|
},
|
|
achievements: [],
|
|
transactions: [],
|
|
market: { selectedRange: '1d' },
|
|
}
|
|
}
|
|
|
|
export function createAuthLoginBody(token: string, me: MeResponse) {
|
|
return {
|
|
token,
|
|
user: { id: me.user.id, name: me.user.name, username: 'testuser' },
|
|
me,
|
|
}
|
|
}
|