重新提交
Change-Id: I41d894c30f6945402022f7309d52d9dfc0ff4c79
diff --git a/src/api/administer.test.js b/src/api/administer.test.js
index beb1e11..e5e785e 100644
--- a/src/api/administer.test.js
+++ b/src/api/administer.test.js
@@ -37,7 +37,7 @@
}
];
- mock.onGet('http://localhost:8088/user/allUser').reply(200, {
+ mock.onGet('/user/allUser').reply(200, {
code: 200,
data: { data: mockUsers }
});
@@ -47,7 +47,7 @@
});
it('should return empty array when no users', async () => {
- mock.onGet('http://localhost:8088/user/allUser').reply(200, {
+ mock.onGet('/user/allUser').reply(200, {
code: 200,
data: { data: [] }
});
@@ -57,7 +57,7 @@
});
it('should handle error when fetching users', async () => {
- mock.onGet('http://localhost:8088/user/allUser').reply(500, {
+ mock.onGet('/user/allUser').reply(500, {
message: 'Request failed with status code 500'
});
@@ -74,7 +74,7 @@
}
];
- mock.onGet('http://localhost:8088/user/searchUser', { params: { key: 'user' } })
+ mock.onGet('/user/searchUser', { params: { key: 'user' } })
.reply(200, {
code: 200,
data: { data: mockUsers }
@@ -92,7 +92,7 @@
}
];
- mock.onGet('http://localhost:8088/user/searchUser', { params: { key: '' } })
+ mock.onGet('/user/searchUser', { params: { key: '' } })
.reply(200, {
code: 200,
data: { data: mockUsers }
@@ -108,7 +108,7 @@
const username = 'user1';
const authority = 'ADMIN';
- mock.onPut('http://localhost:8088/user/changeAuthority', {
+ mock.onPut('/user/changeAuthority', {
changeUsername: username,
authority: authority
}).reply(200, {
@@ -133,7 +133,7 @@
}
];
- mock.onGet('http://localhost:8088/discount/all').reply(200, {
+ mock.onGet('/discount/all').reply(200, {
code: 200,
data: { data: mockDiscounts }
});
@@ -153,7 +153,7 @@
endTime: '2023-05-07T23:59:59'
};
- mock.onGet('http://localhost:8088/discount/current').reply(200, {
+ mock.onGet('/discount/current').reply(200, {
code: 200,
data: { data: mockDiscount }
});
@@ -163,7 +163,7 @@
});
it('should return null when no current discount', async () => {
- mock.onGet('http://localhost:8088/discount/current').reply(200, {
+ mock.onGet('/discount/current').reply(200, {
code: 200,
message: '目前没有进行中的折扣',
data: null
@@ -174,7 +174,7 @@
});
it('should handle error when fetching current discount', async () => {
- mock.onGet('http://localhost:8088/discount/current').reply(500);
+ mock.onGet('/discount/current').reply(500);
await expect(getCurrentDiscount()).rejects.toThrow();
});
@@ -189,7 +189,7 @@
endTime: '2023-06-07T23:59:59'
};
- mock.onPost('http://localhost:8088/discount/add', newDiscount).reply(200, {
+ mock.onPost('/discount/add', newDiscount).reply(200, {
code: 200,
data: { data: { id: 2, ...newDiscount } }
});
@@ -203,7 +203,7 @@
it('should delete discount successfully', async () => {
const discountId = 1;
- mock.onDelete(`http://localhost:8088/discount/delete/${discountId}`).reply(200, {
+ mock.onDelete(`/discount/delete/${discountId}`).reply(200, {
code: 200,
message: '删除成功'
});