|
|
@@ -73,7 +73,7 @@ describe('UserManagement Integration Tests', () => {
|
|
|
const { toast } = await import('sonner');
|
|
|
|
|
|
// Mock initial user list
|
|
|
- (userClient.$get as any).mockResolvedValue({
|
|
|
+ (userClient.index.$get as any).mockResolvedValue({
|
|
|
status: 200,
|
|
|
json: async () => mockUsers,
|
|
|
});
|
|
|
@@ -99,7 +99,7 @@ describe('UserManagement Integration Tests', () => {
|
|
|
fireEvent.change(emailInput, { target: { value: 'new@example.com' } });
|
|
|
|
|
|
// Mock successful creation
|
|
|
- (userClient.$post as any).mockResolvedValue({
|
|
|
+ (userClient.index.$post as any).mockResolvedValue({
|
|
|
status: 201,
|
|
|
});
|
|
|
|
|
|
@@ -107,7 +107,7 @@ describe('UserManagement Integration Tests', () => {
|
|
|
fireEvent.click(submitButton);
|
|
|
|
|
|
await waitFor(() => {
|
|
|
- expect(userClient.$post).toHaveBeenCalledWith({
|
|
|
+ expect(userClient.index.$post).toHaveBeenCalledWith({
|
|
|
json: {
|
|
|
username: 'newuser',
|
|
|
password: 'password123',
|
|
|
@@ -187,7 +187,7 @@ describe('UserManagement Integration Tests', () => {
|
|
|
const { toast } = await import('sonner');
|
|
|
|
|
|
// Mock API error
|
|
|
- (userClient.$get as any).mockRejectedValue(new Error('API Error'));
|
|
|
+ (userClient.index.$get as any).mockRejectedValue(new Error('API Error'));
|
|
|
|
|
|
renderWithProviders(<UserManagement />);
|
|
|
|
|
|
@@ -207,7 +207,7 @@ describe('UserManagement Integration Tests', () => {
|
|
|
fireEvent.change(passwordInput, { target: { value: 'password' } });
|
|
|
|
|
|
// Mock creation error
|
|
|
- (userClient.$post as any).mockRejectedValue(new Error('Creation failed'));
|
|
|
+ (userClient.index.$post as any).mockRejectedValue(new Error('Creation failed'));
|
|
|
|
|
|
const submitButton = screen.getByText('创建用户');
|
|
|
fireEvent.click(submitButton);
|
|
|
@@ -225,7 +225,7 @@ describe('UserManagement Integration Tests', () => {
|
|
|
pagination: { total: 0, page: 1, pageSize: 10 },
|
|
|
};
|
|
|
|
|
|
- (userClient.$get as any).mockResolvedValue({
|
|
|
+ (userClient.index.$get as any).mockResolvedValue({
|
|
|
status: 200,
|
|
|
json: async () => mockUsers,
|
|
|
});
|
|
|
@@ -237,7 +237,7 @@ describe('UserManagement Integration Tests', () => {
|
|
|
fireEvent.change(searchInput, { target: { value: 'searchterm' } });
|
|
|
|
|
|
await waitFor(() => {
|
|
|
- expect(userClient.$get).toHaveBeenCalledWith({
|
|
|
+ expect(userClient.index.$get).toHaveBeenCalledWith({
|
|
|
query: {
|
|
|
page: 1,
|
|
|
pageSize: 10,
|
|
|
@@ -259,7 +259,7 @@ describe('UserManagement Integration Tests', () => {
|
|
|
fireEvent.click(enabledOption);
|
|
|
|
|
|
await waitFor(() => {
|
|
|
- expect(userClient.$get).toHaveBeenCalledWith({
|
|
|
+ expect(userClient.index.$get).toHaveBeenCalledWith({
|
|
|
query: {
|
|
|
page: 1,
|
|
|
pageSize: 10,
|