import {
  channelClient,
  companyClient,
  disabilityClient,
  orderClient,
  platformClient,
  salaryClient,
  enterpriseAuthClient,
  enterpriseCompanyClient,
  enterpriseDisabilityClient,
} from '../src/api'

describe('用人方小程序RPC客户端', () => {
  test('Allin系统模块客户端应正确定义', () => {
    expect(channelClient).toBeDefined()
    expect(companyClient).toBeDefined()
    expect(disabilityClient).toBeDefined()
    expect(orderClient).toBeDefined()
    expect(platformClient).toBeDefined()
    expect(salaryClient).toBeDefined()
  })

  test('企业专用客户端应正确定义', () => {
    expect(enterpriseAuthClient).toBeDefined()
    expect(enterpriseCompanyClient).toBeDefined()
    expect(enterpriseDisabilityClient).toBeDefined()
  })

  test('客户端应包含预期的API方法', () => {
    // 检查企业认证客户端方法
    expect(enterpriseAuthClient.login).toBeDefined()
    expect(enterpriseAuthClient.logout).toBeDefined()
    expect(enterpriseAuthClient.me).toBeDefined()
    expect(enterpriseAuthClient['refresh-token']).toBeDefined()

    // 检查企业统计客户端方法
    expect(enterpriseCompanyClient.overview).toBeDefined()
    expect(enterpriseCompanyClient[':id']['talents']).toBeDefined()
    expect(enterpriseCompanyClient['allocations/recent']).toBeDefined()

    // 检查人才扩展客户端方法
    expect(enterpriseDisabilityClient[':id']['work-history']).toBeDefined()
    expect(enterpriseDisabilityClient[':id']['salary-history']).toBeDefined()
    expect(enterpriseDisabilityClient[':id']['credit-info']).toBeDefined()
    expect(enterpriseDisabilityClient[':id'].videos).toBeDefined()
  })

  test('企业认证客户端方法应具备正确的HTTP方法', () => {
    expect(enterpriseAuthClient.login.$post).toBeDefined()
    expect(enterpriseAuthClient.logout.$post).toBeDefined()
    expect(enterpriseAuthClient.me.$get).toBeDefined()
    expect(enterpriseAuthClient['refresh-token'].$post).toBeDefined()
  })

  test('企业统计客户端方法应具备正确的HTTP方法', () => {
    expect(enterpriseCompanyClient.overview.$get).toBeDefined()
    expect(enterpriseCompanyClient['allocations/recent'].$get).toBeDefined()
  })
})