Refactor Grid module
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { mount, RouterLinkStub } from "@vue/test-utils";
|
||||
import Film from "@/components/Film/Film";
|
||||
import Film from "./";
|
||||
import mockFilms from "@/test/fake-films.json";
|
||||
|
||||
describe("Film", () => {
|
||||
|
||||
26
components/Grid/Grid.spec.js
Normal file
26
components/Grid/Grid.spec.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { shallowMount } from "@vue/test-utils";
|
||||
import Grid from "./";
|
||||
import mockFilms from "@/test/fake-films.json";
|
||||
|
||||
describe("Grid", () => {
|
||||
it("tests props", () => {
|
||||
expect(Grid.props).toMatchObject({
|
||||
dataSource: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("should render Grid instance with expected Film components", () => {
|
||||
const wrapper = shallowMount(Grid, {
|
||||
propsData: {
|
||||
dataSource: mockFilms
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.findAllComponents({ name: "Film" }).length).toBe(
|
||||
mockFilms.length
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div class="grid">
|
||||
<div class="flex flex-wrap">
|
||||
<Film :key="film.id" v-for="film in dataSource" :film="film" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Film from "./Film/Film";
|
||||
import Film from "../Film";
|
||||
|
||||
export default {
|
||||
components: { Film },
|
||||
Reference in New Issue
Block a user