Skip to content

Commit

Permalink
test(ui): fix falling test
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Jan 27, 2023
1 parent 9e02166 commit ec20485
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
20 changes: 8 additions & 12 deletions ui/tests/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {extendMoment} from "moment-range";
import ElementPlus from "element-plus";
import filters from "../src/utils/filters";
import translations from "../src/translations.json";
import stores from "../src/stores/store"
import "../src/utils/global"


Expand All @@ -17,21 +18,12 @@ let i18n = createI18n({
warnHtmlMessage: false,
});

const store = createStore({
modules: {
plugin: {
state: {
icons: []
},
namespaced: true
}
}
});
const store = createStore(stores);

moment.locale("en");

export default (component, options) => {
return mount(
export default (component, options, callback) => {
const app = mount(
component,
{
...{
Expand All @@ -48,4 +40,8 @@ export default (component, options) => {
...options
}
)

callback(store);

return app;
}
25 changes: 17 additions & 8 deletions ui/tests/unit/components/graph/TreeNode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ import EACH_SEQUENTIAL_EXECUTION from "../../../fixtures/executions/each-sequent
import mount from "../../../local.js";

const localMount = (n, execution) => {
return mount(TreeNode, {
props: {
n: n,
execution: execution,
flowId: "flowId",
namespace: "namespace",
return mount(
TreeNode,
{
props: {
n: n,
execution: execution,
flowId: "flowId",
namespace: "namespace",
}
},
(store) => {
store.commit("execution/setExecution", execution)
}
})
)
}

describe("TreeNode", () => {
Expand All @@ -26,7 +32,10 @@ describe("TreeNode", () => {
expect(wrapper.vm.task.id).toBe("1-2");
expect(wrapper.vm.state).toBe("SUCCESS");
expect(wrapper.vm.taskRuns).toHaveLength(3);
expect(wrapper.vm.duration).toBe(0.000633852);
expect(wrapper.vm.histories[0].state).toBe("CREATED");
expect(wrapper.vm.histories[0].date.toISOString()).toBe("2020-12-26T20:38:16.001Z");
expect(wrapper.vm.histories[1].state).toBe("SUCCESS");
expect(wrapper.vm.histories[1].date.toISOString()).toBe("2020-12-26T20:38:16.002Z");
})

it("sorting state", () => {
Expand Down

0 comments on commit ec20485

Please sign in to comment.