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
* Override specific props
* 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;
@ -138,6 +140,14 @@ describe("Unit Test", () => {
actions: {},
properties: {},
})),
thingDescriptions: vi.fn(() => ({
test_thing: {
properties: {
test_property_1: {},
test_property_2: {},
},
},
})),
getOngoingAction: vi.fn(() => Promise.resolve()),
getThingEndpoint: vi.fn(() => Promise.resolve([])),
modalError: "",

View file

@ -13,56 +13,7 @@ export const componentOverrides = {
propertyName: "",
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": {
props: { streamId: "testProp" },
},
@ -112,7 +63,6 @@ export const componentOverrides = {
"inputFromSchema.vue": {
props: { dataSchema: {} },
},
"propertyControl.vue": {
props: {
propertyName: "",
@ -173,16 +123,4 @@ export const componentOverrides = {
"cameraCalibrationSettings.vue": {
props: { cameraUri: "" },
},
"CSMCalibrationSettings.vue": {
global: {
mocks: {
thingDescriptions: {
csm: {
actions: {},
},
},
},
},
},
};