37 lines
No EOL
1.2 KiB
JavaScript
37 lines
No EOL
1.2 KiB
JavaScript
import {getDamageString, compareGlassOptions} from "./damage-helper";
|
|
|
|
jest.mock("@/store", () => ({
|
|
getters: {damage: {
|
|
glassToReplace: [{location: "TEST"}]
|
|
}
|
|
}
|
|
}));
|
|
|
|
describe("damage-helper.js", () => {
|
|
it("Should return damage getter info", () => {
|
|
const damage = getDamageString();
|
|
expect(damage).toEqual("TEST")
|
|
});
|
|
});
|
|
|
|
describe("damage-helper.js", () => {
|
|
it("Should return false if no mismatches between each array", () => {
|
|
const newOptions = {
|
|
windshieldOptions: {availableReplacementOptions: ["windshield"]}
|
|
}
|
|
const currentOptions = [{location: "Windshield", name: "windshield"}];
|
|
const misMatch = compareGlassOptions(newOptions, currentOptions);
|
|
expect(misMatch).toEqual(false);
|
|
});
|
|
});
|
|
|
|
describe("damage-helper.js", () => {
|
|
it("Should return true if there are any mismatches between arrays", () => {
|
|
const newOptions = {
|
|
windshieldOptions: {availableReplacementOptions: ["window"]}
|
|
}
|
|
const currentOptions = [{location: "Windshield", name: "windshield"}];
|
|
const misMatch = compareGlassOptions(newOptions, currentOptions);
|
|
expect(misMatch).toEqual(true);
|
|
});
|
|
}); |