Test Film component

This commit is contained in:
2020-12-18 01:47:06 +01:00
parent ab465bbe16
commit f937bfcf4c
3 changed files with 32 additions and 18 deletions

View File

@@ -0,0 +1,30 @@
import { mount, RouterLinkStub } from "@vue/test-utils";
import Film from "@/components/Film/Film";
import mockFilms from "@/test/fake-films.json";
describe("Film", () => {
it("tests props", () => {
expect(Film.props).toMatchObject({
film: {
type: Object,
default: {},
required: true
}
});
});
it("renders proper link to details", () => {
const wrapper = mount(Film, {
propsData: {
film: mockFilms[0]
},
stubs: {
RouterLink: RouterLinkStub
}
});
expect(wrapper.findComponent(RouterLinkStub).props().to).toBe(
`/film/${mockFilms[0].id}`
);
});
});

View File

@@ -43,7 +43,7 @@ export default {
props: { props: {
film: { film: {
type: Object, type: Object,
default: () => {}, default: {},
required: true required: true
} }
}, },
@@ -56,22 +56,6 @@ export default {
</script> </script>
<style lang="css" scoped> <style lang="css" scoped>
/* .film {
flex: 1 1 calc(50% - 2rem);
}
@media screen and (min-width: 600px) {
.card {
flex: 1 1 calc(50% - 2rem);
}
}
@media screen and (min-width: 900px) {
.card {
flex: 1 1 calc(33% - 2rem);
}
} */
header { header {
background-color: #85ffbd; background-color: #85ffbd;
background-image: linear-gradient(45deg, #85ffbd 0%, #fffb7d 100%); background-image: linear-gradient(45deg, #85ffbd 0%, #fffb7d 100%);

View File

@@ -5,7 +5,7 @@
</template> </template>
<script> <script>
import Film from "./Film"; import Film from "./Film/Film";
export default { export default {
components: { Film }, components: { Film },