| 123456789101112131415161718 |
- import { describe, it, expect } from 'vitest'
- import { http, createRequestController } from '@/api/request'
- describe('request layer', () => {
- it('http exposes typed methods', () => {
- expect(typeof http.get).toBe('function')
- expect(typeof http.post).toBe('function')
- expect(typeof http.put).toBe('function')
- expect(typeof http.delete).toBe('function')
- })
- it('createRequestController returns an AbortController', () => {
- const controller = createRequestController()
- expect(controller).toBeInstanceOf(AbortController)
- expect(typeof controller.abort).toBe('function')
- expect(typeof controller.signal).toBe('object')
- })
- })
|