From 8b0fd5153b988533e5ef900705ea2c90333eb526 Mon Sep 17 00:00:00 2001 From: Will Sheldon <114631109+wssheldon@users.noreply.github.com> Date: Wed, 6 Dec 2023 08:52:09 -0800 Subject: [PATCH 1/3] Add CaseStatusSelect group tests, refactor to script setup, and fix a couple bugs (#4088) * Add CaseStatusSelect group tests, refactor to script setup, and fix a couple bugs * Remove mocked case api for now --- .../src/case/CaseStatusSelectGroup.vue | 164 ++++++++++-------- .../src/tests/CaseStatusSelectGroup.spec.js | 71 ++++++++ 2 files changed, 165 insertions(+), 70 deletions(-) create mode 100644 src/dispatch/static/dispatch/src/tests/CaseStatusSelectGroup.spec.js diff --git a/src/dispatch/static/dispatch/src/case/CaseStatusSelectGroup.vue b/src/dispatch/static/dispatch/src/case/CaseStatusSelectGroup.vue index 9fc8b751c144..a1069e310914 100644 --- a/src/dispatch/static/dispatch/src/case/CaseStatusSelectGroup.vue +++ b/src/dispatch/static/dispatch/src/case/CaseStatusSelectGroup.vue @@ -70,83 +70,107 @@ - diff --git a/src/dispatch/static/dispatch/src/tests/CaseStatusSelectGroup.spec.js b/src/dispatch/static/dispatch/src/tests/CaseStatusSelectGroup.spec.js new file mode 100644 index 000000000000..47ee1f2e0068 --- /dev/null +++ b/src/dispatch/static/dispatch/src/tests/CaseStatusSelectGroup.spec.js @@ -0,0 +1,71 @@ +import { mount } from "@vue/test-utils" +import { createStore } from "vuex" +import { createVuetify } from "vuetify" +import * as components from "vuetify/components" +import * as directives from "vuetify/directives" +import { describe, expect, it, vi, afterEach, beforeEach } from "vitest" +import CaseStatusSelectGroup from "@/case/CaseStatusSelectGroup.vue" + +const vuetify = createVuetify({ + components, + directives, +}) + +global.ResizeObserver = require("resize-observer-polyfill") + +describe("CaseStatusSelectGroup", () => { + let actions + let mockStore + let wrapper + + beforeEach(() => { + // Mock the store and actions + actions = { + addBeNotification: vi.fn(), + } + + mockStore = createStore({ + modules: { + notification_backend: { + namespaced: true, + actions, + }, + case_management: { + namespaced: true, + state: { + selected: { + id: 1, + status: "New", + }, + }, + }, + }, + }) + + // Mount the component + wrapper = mount(CaseStatusSelectGroup, { + props: { + modelValue: { + status: "New", + created_at: "2022-01-01", + }, + }, + global: { + plugins: [mockStore, vuetify], // 👈 + }, + }) + }) + + afterEach(() => { + vi.restoreAllMocks() + }) + + it("mounts correctly", () => { + expect(wrapper.exists()).toBe(true) + }) + + it("opens dialog on status click", async () => { + await wrapper.find(".overlap-card").trigger("click") + expect(wrapper.vm.dialogVisible).toBe(true) + }) +}) From 9f9c4d74badeddbb4914b416ebe43b52610e0a2c Mon Sep 17 00:00:00 2001 From: Will Sheldon <114631109+wssheldon@users.noreply.github.com> Date: Wed, 6 Dec 2023 08:58:53 -0800 Subject: [PATCH 2/3] Use ellipsis in the signal name list on case page to avoid format issues (#4089) --- .../static/dispatch/src/case/CaseSignalInstanceTab.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/dispatch/static/dispatch/src/case/CaseSignalInstanceTab.vue b/src/dispatch/static/dispatch/src/case/CaseSignalInstanceTab.vue index 1a2b9f1c000d..69dbf9aba704 100644 --- a/src/dispatch/static/dispatch/src/case/CaseSignalInstanceTab.vue +++ b/src/dispatch/static/dispatch/src/case/CaseSignalInstanceTab.vue @@ -7,7 +7,7 @@