mirror of
https://github.com/langgenius/dify.git
synced 2026-03-18 05:09:54 +08:00
test(billing): mock utility functions for plan limits in VectorSpaceFull tests
- Introduce mock for getPlanVectorSpaceLimitMB to control plan limits for sandbox and team - Update VectorSpaceFull test to reflect correct storage limit display based on plan type
This commit is contained in:
@ -21,6 +21,18 @@ vi.mock('../upgrade-btn', () => ({
|
||||
default: () => <button data-testid="vector-upgrade-btn" type="button">Upgrade</button>,
|
||||
}))
|
||||
|
||||
// Mock utils to control threshold and plan limits
|
||||
vi.mock('../utils', () => ({
|
||||
getPlanVectorSpaceLimitMB: (planType: string) => {
|
||||
// Return 5 for sandbox (threshold) and 100 for team
|
||||
if (planType === 'sandbox')
|
||||
return 5
|
||||
if (planType === 'team')
|
||||
return 100
|
||||
return 0
|
||||
},
|
||||
}))
|
||||
|
||||
describe('VectorSpaceFull', () => {
|
||||
const planMock = {
|
||||
type: 'team',
|
||||
@ -52,6 +64,6 @@ describe('VectorSpaceFull', () => {
|
||||
render(<VectorSpaceFull />)
|
||||
|
||||
expect(screen.getByText('8')).toBeInTheDocument()
|
||||
expect(screen.getByText('10MB')).toBeInTheDocument()
|
||||
expect(screen.getByText('100MB')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user