mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-07 15:57:53 +08:00
test(frontend): mock getLiveCapability and align rollback timeout
Stub GroupsView live capability API in unit tests and expect the longer system rollback request timeout; refresh pnpm-lock after dependency resolve.
This commit is contained in:
Generated
+705
-733
File diff suppressed because it is too large
Load Diff
@@ -41,7 +41,11 @@ describe('admin system rollback API', () => {
|
||||
|
||||
const result = await rollback('0.1.146')
|
||||
|
||||
expect(post).toHaveBeenCalledWith('/admin/system/rollback', { version: '0.1.146' })
|
||||
expect(post).toHaveBeenCalledWith(
|
||||
'/admin/system/rollback',
|
||||
{ version: '0.1.146' },
|
||||
{ timeout: 15 * 60 * 1000 }
|
||||
)
|
||||
expect(result.need_restart).toBe(true)
|
||||
})
|
||||
|
||||
@@ -50,6 +54,10 @@ describe('admin system rollback API', () => {
|
||||
|
||||
await rollback()
|
||||
|
||||
expect(post).toHaveBeenCalledWith('/admin/system/rollback', undefined)
|
||||
expect(post).toHaveBeenCalledWith(
|
||||
'/admin/system/rollback',
|
||||
undefined,
|
||||
{ timeout: 15 * 60 * 1000 }
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -10,6 +10,7 @@ const {
|
||||
getModelsListCandidates,
|
||||
getUsageSummary,
|
||||
getCapacitySummary,
|
||||
getLiveCapability,
|
||||
listAccounts,
|
||||
showError,
|
||||
showSuccess,
|
||||
@@ -21,6 +22,7 @@ const {
|
||||
getModelsListCandidates: vi.fn(),
|
||||
getUsageSummary: vi.fn(),
|
||||
getCapacitySummary: vi.fn(),
|
||||
getLiveCapability: vi.fn(),
|
||||
listAccounts: vi.fn(),
|
||||
showError: vi.fn(),
|
||||
showSuccess: vi.fn(),
|
||||
@@ -51,6 +53,7 @@ vi.mock('@/api/admin', () => ({
|
||||
getModelsListCandidates,
|
||||
getUsageSummary,
|
||||
getCapacitySummary,
|
||||
getLiveCapability,
|
||||
create: vi.fn(),
|
||||
update: vi.fn(),
|
||||
delete: vi.fn(),
|
||||
@@ -244,6 +247,7 @@ describe('admin GroupsView column settings', () => {
|
||||
getModelsListCandidates.mockResolvedValue([])
|
||||
getUsageSummary.mockResolvedValue([])
|
||||
getCapacitySummary.mockResolvedValue([])
|
||||
getLiveCapability.mockResolvedValue({ supported: false })
|
||||
listAccounts.mockResolvedValue({ items: [], total: 0, page: 1, page_size: 20, pages: 0 })
|
||||
isCurrentStep.mockReturnValue(false)
|
||||
})
|
||||
|
||||
@@ -11,6 +11,7 @@ const {
|
||||
getModelsListCandidates,
|
||||
getUsageSummary,
|
||||
getCapacitySummary,
|
||||
getLiveCapability,
|
||||
showSuccess,
|
||||
showError
|
||||
} = vi.hoisted(() => ({
|
||||
@@ -19,6 +20,7 @@ const {
|
||||
getModelsListCandidates: vi.fn(),
|
||||
getUsageSummary: vi.fn(),
|
||||
getCapacitySummary: vi.fn(),
|
||||
getLiveCapability: vi.fn(),
|
||||
showSuccess: vi.fn(),
|
||||
showError: vi.fn()
|
||||
}))
|
||||
@@ -31,6 +33,7 @@ vi.mock('@/api/admin', () => ({
|
||||
getModelsListCandidates,
|
||||
getUsageSummary,
|
||||
getCapacitySummary,
|
||||
getLiveCapability,
|
||||
getAll: vi.fn(),
|
||||
create: vi.fn(),
|
||||
update: vi.fn(),
|
||||
@@ -166,6 +169,7 @@ describe('GroupsView duplicate action', () => {
|
||||
getModelsListCandidates,
|
||||
getUsageSummary,
|
||||
getCapacitySummary,
|
||||
getLiveCapability,
|
||||
showSuccess,
|
||||
showError
|
||||
]) {
|
||||
@@ -188,6 +192,7 @@ describe('GroupsView duplicate action', () => {
|
||||
getModelsListCandidates.mockResolvedValue([])
|
||||
getUsageSummary.mockResolvedValue([])
|
||||
getCapacitySummary.mockResolvedValue([])
|
||||
getLiveCapability.mockResolvedValue({ supported: false })
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user