ui_migration feature(vitest) Reduce boilerplate code at overrides

This commit is contained in:
Antonio Anaya 2026-06-17 01:53:51 -06:00 committed by Antonio Anaya
parent ffcc7f936b
commit c33782e9d6
2 changed files with 11 additions and 63 deletions

View file

@ -110,7 +110,9 @@ describe("Unit Test", () => {
* Look up the specific config for this file, default to an empty object * Look up the specific config for this file, default to an empty object
* Override specific props * Override specific props
* Inject the specific state if it exists, otherwise use empty object * Inject the specific state if it exists, otherwise use empty object
* Mocks values come from MIXINS * * Note on Global Mocks:
* The mock functions below stub out standard Mixin methods that typically interact with the Pinia store.
* These should not be moved to `overrides.js` Defining them here significantly reduces boilerplate configuration inside `overrides.js`.
*/ */
const testRunner = isSkipped ? it.skip : it; const testRunner = isSkipped ? it.skip : it;
@ -138,6 +140,14 @@ describe("Unit Test", () => {
actions: {}, actions: {},
properties: {}, properties: {},
})), })),
thingDescriptions: vi.fn(() => ({
test_thing: {
properties: {
test_property_1: {},
test_property_2: {},
},
},
})),
getOngoingAction: vi.fn(() => Promise.resolve()), getOngoingAction: vi.fn(() => Promise.resolve()),
getThingEndpoint: vi.fn(() => Promise.resolve([])), getThingEndpoint: vi.fn(() => Promise.resolve([])),
modalError: "", modalError: "",

View file

@ -13,56 +13,7 @@ export const componentOverrides = {
propertyName: "", propertyName: "",
thingName: "", thingName: "",
}, },
global: {
mocks: {
wotStore: {
thingDescriptions: {
test_thing: {
properties: {
test_property_1: {},
test_property_2: {},
},
},
},
},
},
},
}, },
"slideScanContent.vue": {
global: {
mocks: {
wotStore: {
thingDescriptions: {
test_thing: {
properties: {
test_property_1: {},
test_property_2: {},
},
},
},
},
},
},
},
"slideScanControls.vue": {
global: {
mocks: {
wotStore: {
thingDescriptions: {
test_thing: {
properties: {
test_property_1: {},
test_property_2: {},
},
},
},
},
},
},
},
"miniStreamDisplay.vue": { "miniStreamDisplay.vue": {
props: { streamId: "testProp" }, props: { streamId: "testProp" },
}, },
@ -112,7 +63,6 @@ export const componentOverrides = {
"inputFromSchema.vue": { "inputFromSchema.vue": {
props: { dataSchema: {} }, props: { dataSchema: {} },
}, },
"propertyControl.vue": { "propertyControl.vue": {
props: { props: {
propertyName: "", propertyName: "",
@ -173,16 +123,4 @@ export const componentOverrides = {
"cameraCalibrationSettings.vue": { "cameraCalibrationSettings.vue": {
props: { cameraUri: "" }, props: { cameraUri: "" },
}, },
"CSMCalibrationSettings.vue": {
global: {
mocks: {
thingDescriptions: {
csm: {
actions: {},
},
},
},
},
},
}; };