This commit is contained in:
2026-07-12 12:20:23 +08:00
parent 7f2d5579ff
commit f923791d39
252 changed files with 9872 additions and 647 deletions
@@ -55,8 +55,11 @@ export const actions = {
commit(types.default.SET_AGENT_CREATING_STATUS, true);
try {
const response = await AgentAPI.create(agentInfo);
commit(types.default.ADD_AGENT, response.data);
const agent = { ...response.data };
delete agent.temporary_password;
commit(types.default.ADD_AGENT, agent);
commit(types.default.SET_AGENT_CREATING_STATUS, false);
return response.data;
} catch (error) {
commit(types.default.SET_AGENT_CREATING_STATUS, false);
throw error;
@@ -31,8 +31,14 @@ describe('#actions', () => {
describe('#create', () => {
it('sends correct actions if API is success', async () => {
axios.post.mockResolvedValue({ data: agentList[0] });
await actions.create({ commit }, agentList[0]);
const responseAgent = {
...agentList[0],
temporary_password: 'InitialPassword1!',
};
axios.post.mockResolvedValue({ data: responseAgent });
const createdAgent = await actions.create({ commit }, agentList[0]);
expect(createdAgent).toEqual(responseAgent);
expect(commit.mock.calls).toEqual([
[types.default.SET_AGENT_CREATING_STATUS, true],
[types.default.ADD_AGENT, agentList[0]],