fix(plugin-workflow): fix test case (#1172)

This commit is contained in:
Junyi 2022-12-01 07:40:36 -08:00 committed by GitHub
parent 400320d175
commit 271573c52a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -328,6 +328,16 @@ describe('workflow > actions > workflows', () => {
expect(w2.enabled).toBe(false); expect(w2.enabled).toBe(false);
expect(w2.allExecuted).toBe(0); expect(w2.allExecuted).toBe(0);
// stop w1
await WorkflowModel.update({
enabled: false
}, {
where: {
id: w1.id
},
individualHooks: true
});
await WorkflowModel.update({ await WorkflowModel.update({
enabled: true enabled: true
}, { }, {
@ -345,10 +355,10 @@ describe('workflow > actions > workflows', () => {
order: [['id', 'ASC']] order: [['id', 'ASC']]
}); });
expect(w1next.enabled).toBe(true); expect(w1next.enabled).toBe(false);
expect(w1next.current).toBe(true); expect(w1next.current).toBe(true);
expect(w1next.executed).toBe(2); expect(w1next.executed).toBe(1);
expect(w1next.allExecuted).toBe(2); expect(w1next.allExecuted).toBe(1);
expect(w2next.enabled).toBe(true); expect(w2next.enabled).toBe(true);
expect(w2next.executed).toBe(1); expect(w2next.executed).toBe(1);
expect(w2next.allExecuted).toBe(1); expect(w2next.allExecuted).toBe(1);
@ -356,7 +366,6 @@ describe('workflow > actions > workflows', () => {
const [e1] = await w1next.getExecutions(); const [e1] = await w1next.getExecutions();
const [e2] = await w2next.getExecutions(); const [e2] = await w2next.getExecutions();
expect(e1.key).not.toBe(e2.key); expect(e1.key).not.toBe(e2.key);
expect(e1.workflowId).toBe(w1.id);
expect(e2.workflowId).toBe(w2.id); expect(e2.workflowId).toBe(w2.id);
}); });
}); });