Add test for review content block
This commit is contained in:
parent
a284821444
commit
949849f035
2 changed files with 36 additions and 3 deletions
|
|
@ -1,3 +1,36 @@
|
|||
describe("Review Page Content Block", () => {
|
||||
test.todo("Add more tests as specific functionality is added.");
|
||||
import { shallowMount } from "@vue/test-utils";
|
||||
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||
import store from "@/store";
|
||||
import reviewBlock from "@/layouts/review/review-block/review-block";
|
||||
|
||||
jest.mock("@/helpers/cms-content-helper", () => ({
|
||||
fetchCmsContentForPage: () => Promise.resolve("content"),
|
||||
}));
|
||||
|
||||
describe("Review Content Block", () => {
|
||||
test("Displays one new line of content for each element in the content prop.", () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({
|
||||
propsData: {
|
||||
headerCmsWidgetName: "TestWidget",
|
||||
content: ["a", "b", "c", "d"],
|
||||
},
|
||||
});
|
||||
|
||||
// Act
|
||||
const contentLines = wrapper.findAll("[data-test='contentLine']");
|
||||
|
||||
// Assert
|
||||
expect(contentLines.length).toBe(4);
|
||||
});
|
||||
});
|
||||
|
||||
function setupMocks(customMountOptions) {
|
||||
const mountOptions = getMountOptions(customMountOptions);
|
||||
|
||||
mountOptions["attachTo"] = document.body;
|
||||
|
||||
const wrapper = shallowMount(reviewBlock, mountOptions);
|
||||
wrapper.vm.setCmsContent = jest.fn();
|
||||
return { wrapper };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
margin="mt-0" />
|
||||
<textLink linkType="textSmall" text="Edit" class="ml-auto" @click-event="linkClicked" />
|
||||
</div>
|
||||
<div class="small" v-for="item in content" :key="item">
|
||||
<div class="small" v-for="item in content" :key="item" data-test="contentLine">
|
||||
{{ item }}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue