|
| 1 | +// @vitest-environment nuxt |
| 2 | + |
| 3 | +import { describe, expect, test } from "vitest" |
| 4 | +import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime" |
| 5 | + |
| 6 | +import { createVuetify } from "vuetify" |
| 7 | +import * as components from "vuetify/components" |
| 8 | +import * as directives from "vuetify/directives" |
| 9 | + |
| 10 | +import InspectorResultPanel from "@/components/Inspector/ResultPanel.vue" |
| 11 | +import schemas from "@geode/opengeodeweb-back/schemas.json" |
| 12 | + |
| 13 | +const inspect_file_schema = schemas.opengeodeweb_back.inspect_file |
| 14 | + |
| 15 | +const vuetify = createVuetify({ |
| 16 | + components, |
| 17 | + directives, |
| 18 | +}) |
| 19 | + |
| 20 | +const inpection_result = [ |
| 21 | + { |
| 22 | + title: "Brep inspection", |
| 23 | + nb_issues: 27, |
| 24 | + children: [ |
| 25 | + { |
| 26 | + title: "Model topology inspection", |
| 27 | + nb_issues: 25, |
| 28 | + children: [ |
| 29 | + { title: "test topology 1", nb_issues: 25 }, |
| 30 | + { title: "test topology 2", nb_issues: 0 }, |
| 31 | + ], |
| 32 | + }, |
| 33 | + { |
| 34 | + title: "Meshes inspection", |
| 35 | + nb_issues: 2, |
| 36 | + children: [ |
| 37 | + { title: "test meshes 1", nb_issues: 1 }, |
| 38 | + { title: "test meshes 2", nb_issues: 1 }, |
| 39 | + ], |
| 40 | + }, |
| 41 | + ], |
| 42 | + }, |
| 43 | +] |
| 44 | + |
| 45 | +describe("Inspector/ResultPanel.vue", async () => { |
| 46 | + test(`Test render`, async () => { |
| 47 | + const wrapper = mount(InspectorResultPanel, { |
| 48 | + global: { |
| 49 | + plugins: [vuetify], |
| 50 | + }, |
| 51 | + props: { inspection_results: [], fetch_results: true }, |
| 52 | + }) |
| 53 | + const td = await wrapper.find("td") |
| 54 | + await wrapper.vm.$nextTick() |
| 55 | + const input = await td.find("input") |
| 56 | + await input.trigger("click") |
| 57 | + expect(wrapper.emitted()).toHaveProperty("update_values") |
| 58 | + expect(wrapper.emitted().update_values).toHaveLength(1) |
| 59 | + expect(wrapper.emitted().update_values[0][0]).toEqual({ |
| 60 | + [inspection_results]: crs_list[0], |
| 61 | + }) |
| 62 | + }) |
| 63 | +}) |
0 commit comments