diff --git a/components/helpers/profile_picture.spec.ts b/components/helpers/profile_picture.spec.ts new file mode 100644 index 000000000..85b8c10fc --- /dev/null +++ b/components/helpers/profile_picture.spec.ts @@ -0,0 +1,42 @@ +import { shallowMount } from "@vue/test-utils" + +import Component from "./profile_picture.vue" + +describe("Component: helpers/profile_picture_item", () => { + it("should show if user has profile picture", () => { + const sampleURL = "/images/profile.png" + const wrapper = shallowMount(Component, { + "props": { + "user": { + "data": { + "profilePicture": { + "data": { + "fileContents": sampleURL + } + } + } + } + } + }) + + const image = wrapper.find("img") + const source = image.attributes("src") + + expect(source).toBe(sampleURL) + }) + + it("should show if user has profile picture", () => { + const wrapper = shallowMount(Component, { + "props": { + "user": { + "data": {} + } + } + }) + + const image = wrapper.find("img") + const source = image.attributes("src") + + expect(source).toBe("stub") + }) +}) diff --git a/components/helpers/profile_picture.vue b/components/helpers/profile_picture.vue new file mode 100644 index 000000000..0b3c8dc4e --- /dev/null +++ b/components/helpers/profile_picture.vue @@ -0,0 +1,31 @@ + +