功能:完善订单流程和加固
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { isApiAuthFreePath, WEB_API_AUTH_FREE_PATHS } from '@/api/auth-free-paths'
|
||||
|
||||
describe('auth-free API contract', () => {
|
||||
it('covers public paths and rejects protected business APIs', () => {
|
||||
expect(isApiAuthFreePath('/comment/list/product/1')).toBe(true)
|
||||
expect(isApiAuthFreePath('/user/wechat-mini/auto-login')).toBe(true)
|
||||
expect(isApiAuthFreePath('/admin/auth/login-shops/1')).toBe(true)
|
||||
|
||||
expect(isApiAuthFreePath('/order/list')).toBe(false)
|
||||
expect(isApiAuthFreePath('/shop/delete/1')).toBe(false)
|
||||
expect(isApiAuthFreePath('/permission/list')).toBe(false)
|
||||
expect(isApiAuthFreePath('/order/list?next=/user/login')).toBe(false)
|
||||
expect(isApiAuthFreePath('/user/profile/admin/auth/refresh')).toBe(false)
|
||||
})
|
||||
|
||||
it('keeps auth-free path constants unique', () => {
|
||||
expect(new Set(WEB_API_AUTH_FREE_PATHS).size).toBe(WEB_API_AUTH_FREE_PATHS.length)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user