import { describe, it, expect } from 'vitest'

describe('APP_CONFIG', () => {
  it('should have APP_NAME', async () => {
    const { APP_CONFIG } = await import('./config')
    expect(APP_CONFIG.APP_NAME).toBeTruthy()
  })

  it('should have storage keys', async () => {
    const { APP_CONFIG } = await import('./config')
    expect(APP_CONFIG.STORAGE_KEYS.TOKEN).toBe('token')
    expect(APP_CONFIG.STORAGE_KEYS.USER_ID).toBe('userId')
  })

  it('should have page routes', async () => {
    const { APP_CONFIG } = await import('./config')
    expect(APP_CONFIG.PAGES.INDEX).toBe('/pages/index/index')
    expect(APP_CONFIG.PAGES.LOGIN).toBe('/pages/login/login')
    expect(APP_CONFIG.PAGES.MEMBER).toBe('/pages/member/member')
  })
})

describe('API_ENDPOINTS', () => {
  it('should have all endpoint groups', async () => {
    const { API_ENDPOINTS } = await import('./config')
    expect(API_ENDPOINTS.USER).toBeDefined()
    expect(API_ENDPOINTS.INTERVIEW).toBeDefined()
    expect(API_ENDPOINTS.PAYMENT).toBeDefined()
    expect(API_ENDPOINTS.PROGRESS).toBeDefined()
    expect(API_ENDPOINTS.CONTRIBUTION).toBeDefined()
    expect(API_ENDPOINTS.MEMBER).toBeDefined()
  })

  it('should have user endpoints', async () => {
    const { API_ENDPOINTS } = await import('./config')
    expect(API_ENDPOINTS.USER.SEND_CODE).toBe('/user/send-code')
    expect(API_ENDPOINTS.USER.LOGIN).toBe('/user/login')
    expect(API_ENDPOINTS.USER.INFO).toBe('/user/info')
  })

  it('should generate dynamic interview endpoints', async () => {
    const { API_ENDPOINTS } = await import('./config')
    expect(API_ENDPOINTS.INTERVIEW.ANSWER('abc')).toBe('/interview/abc/answer')
    expect(API_ENDPOINTS.INTERVIEW.GET('xyz')).toBe('/interview/xyz')
  })

  it('should generate dynamic payment check endpoint', async () => {
    const { API_ENDPOINTS } = await import('./config')
    expect(API_ENDPOINTS.PAYMENT.CHECK('ORD123')).toBe('/payment/check/ORD123')
  })
})
