@@ -9,6 +9,7 @@ import * as directives from "vuetify/directives"
99
1010import ExtensionSelector from "@/components/ExtensionSelector.vue"
1111import schema from "@/assets/schemas/ExtensionSelector.json"
12+ import { flushPromises } from "@vue/test-utils"
1213
1314const vuetify = createVuetify ( {
1415 components,
@@ -18,9 +19,10 @@ const vuetify = createVuetify({
1819global . ResizeObserver = require ( "resize-observer-polyfill" )
1920
2021describe ( "ExtensionSelector.vue" , async ( ) => {
21- test ( `BRep ` , async ( ) => {
22+ test ( `Select geode_object & extension ` , async ( ) => {
2223 const output_geode_object = "BRep"
2324 const output_extension = "msh"
25+
2426 registerEndpoint ( schema . $id , {
2527 method : schema . method ,
2628 handler : ( ) => ( {
@@ -29,24 +31,21 @@ describe("ExtensionSelector.vue", async () => {
2931 } ,
3032 } ) ,
3133 } )
32- // const wrapper = await mountSuspended(ExtensionSelector, {
33- // global: {
34- // plugins: [vuetify],
35- // },
36- // props: { input_geode_object: "BRep", filenames: ["test.toto"] },
37- // })
38- // const first_v_card = await wrapper.findComponent(components.VCard)
39- // console.log("first_v_card", first_v_card)
40- // const second_v_card = first_v_card.findComponent(components.VCard)
41- // console.log("second_v_card", second_v_card)
42-
43- // await second_v_card.trigger("click")
44- // expect(wrapper.emitted()).toHaveProperty("update_values")
45- // expect(wrapper.emitted().update_values).toHaveLength(1)
46- // expect(wrapper.emitted().update_values[0][0]).toEqual({
47- // output_geode_object,
48- // output_extension,
49- // })
34+ const wrapper = await mountSuspended ( ExtensionSelector , {
35+ global : {
36+ plugins : [ vuetify ] ,
37+ } ,
38+ props : { input_geode_object : "BRep" , filenames : [ "test.toto" ] } ,
39+ } )
40+ await nextTick ( )
41+ expect ( wrapper . exists ( ) ) . toBe ( true )
42+ const v_card = await wrapper . findAllComponents ( components . VCard )
43+ await v_card [ 1 ] . trigger ( "click" )
44+ expect ( wrapper . emitted ( ) ) . toHaveProperty ( "update_values" )
45+ expect ( wrapper . emitted ( ) . update_values ) . toHaveLength ( 1 )
46+ expect ( wrapper . emitted ( ) . update_values [ 0 ] [ 0 ] ) . toEqual ( {
47+ output_geode_object,
48+ output_extension,
49+ } )
5050 } )
5151} )
52- // }
0 commit comments