Update unit test.
This commit is contained in:
parent
c61e83695a
commit
62550ab6a0
3 changed files with 28 additions and 40 deletions
|
|
@ -4,7 +4,9 @@ import vinInformation from "@/layouts/vin-lookup/vin-information/vin-information
|
||||||
describe("vinInformation.vue", () => {
|
describe("vinInformation.vue", () => {
|
||||||
it("Should return input class active if isActive is true", async () => {
|
it("Should return input class active if isActive is true", async () => {
|
||||||
// Act
|
// Act
|
||||||
const wrapper = shallowMount(vinInformation);
|
const wrapper = shallowMount(vinInformation, {
|
||||||
|
mixins: [mockMixin]
|
||||||
|
});
|
||||||
|
|
||||||
await wrapper.setData({
|
await wrapper.setData({
|
||||||
isActive: true,
|
isActive: true,
|
||||||
|
|
@ -16,3 +18,9 @@ describe("vinInformation.vue", () => {
|
||||||
expect(wrapper.vm.isActive).toEqual(false);
|
expect(wrapper.vm.isActive).toEqual(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const mockMixin = {
|
||||||
|
methods: {
|
||||||
|
getCmsContent: jest.fn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,29 +18,9 @@
|
||||||
|
|
||||||
import textLink from "@/ux-components/text-link/text-link";
|
import textLink from "@/ux-components/text-link/text-link";
|
||||||
//Supporting files
|
//Supporting files
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
export default {
|
export default {
|
||||||
name: "vinInformation",
|
name: "vinInformation",
|
||||||
async beforeRouteEnter(to, from, next) {
|
|
||||||
// Call APIs
|
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
|
||||||
|
|
||||||
// Settle promises and get results
|
|
||||||
const promiseResultMap = [
|
|
||||||
{
|
|
||||||
resultKey: "cmsContent",
|
|
||||||
promise: cmsContentPromise,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
|
||||||
|
|
||||||
// Call the "next" function to complete the transition to this page.
|
|
||||||
next((vm) => {
|
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
components: {
|
components: {
|
||||||
textLink,
|
textLink,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue