diff --git a/src/components/feature-board-link-element/components/LinkContentElement.unit.ts b/src/components/feature-board-link-element/components/LinkContentElement.unit.ts index 37e28e9fb1..e1dd367764 100644 --- a/src/components/feature-board-link-element/components/LinkContentElement.unit.ts +++ b/src/components/feature-board-link-element/components/LinkContentElement.unit.ts @@ -123,7 +123,7 @@ describe("LinkContentElement", () => { const component = wrapper.getComponent(LinkContentElementCreate); component.vm.$emit("create:url", "https://abc.de"); - expect(useMetaTagExtractorApiMock.getData).toHaveBeenCalled(); + expect(useMetaTagExtractorApiMock.extractMetaTags).toHaveBeenCalled(); }); describe("when no protocol was provided", () => { @@ -135,7 +135,7 @@ describe("LinkContentElement", () => { component.vm.$emit("create:url", url); const expected = `https://${url}`; - expect(useMetaTagExtractorApiMock.getData).toHaveBeenCalledWith( + expect(useMetaTagExtractorApiMock.extractMetaTags).toHaveBeenCalledWith( expected ); }); @@ -153,7 +153,9 @@ describe("LinkContentElement", () => { imageUrl: "https://abc.de/foto.png", }; - useMetaTagExtractorApiMock.getData.mockResolvedValue(fakeMetaTags); + useMetaTagExtractorApiMock.extractMetaTags.mockResolvedValue( + fakeMetaTags + ); const component = wrapper.getComponent(LinkContentElementCreate); component.vm.$emit("create:url", url); diff --git a/src/components/feature-board-link-element/components/LinkContentElement.vue b/src/components/feature-board-link-element/components/LinkContentElement.vue index eecd6cb881..54468c2f5c 100644 --- a/src/components/feature-board-link-element/components/LinkContentElement.vue +++ b/src/components/feature-board-link-element/components/LinkContentElement.vue @@ -89,7 +89,7 @@ export default defineComponent({ () => props.isEditMode && !computedElement.value.content.url ); - const { getData } = useMetaTagExtractorApi(); + const { extractMetaTags } = useMetaTagExtractorApi(); const { createPreviewImage } = usePreviewGenerator(element.value.id); @@ -100,7 +100,7 @@ export default defineComponent({ const validUrl = ensureProtocolIncluded(originalUrl); modelValue.value.url = validUrl; - const { title, description, imageUrl } = await getData(validUrl); + const { title, description, imageUrl } = await extractMetaTags(validUrl); modelValue.value.title = title; modelValue.value.description = description; diff --git a/src/components/feature-board-link-element/composables/MetaTagExtractorApi.composable.ts b/src/components/feature-board-link-element/composables/MetaTagExtractorApi.composable.ts index 70aa2c535c..2a5c1d295a 100644 --- a/src/components/feature-board-link-element/composables/MetaTagExtractorApi.composable.ts +++ b/src/components/feature-board-link-element/composables/MetaTagExtractorApi.composable.ts @@ -11,7 +11,7 @@ type MetaTagResult = { export const useMetaTagExtractorApi = () => { const metaTagApi = MetaTagExtractorApiFactory(undefined, "/v3", $axios); - const getData = async (url: string): Promise => { + const extractMetaTags = async (url: string): Promise => { try { const res = await metaTagApi.metaTagExtractorControllerGetData({ url, @@ -28,6 +28,6 @@ export const useMetaTagExtractorApi = () => { }; return { - getData, + extractMetaTags, }; }; diff --git a/src/components/feature-board-link-element/composables/MetaTagExtractorApi.composable.unit.ts b/src/components/feature-board-link-element/composables/MetaTagExtractorApi.composable.unit.ts index 6755eaf4a5..3232e8a2bf 100644 --- a/src/components/feature-board-link-element/composables/MetaTagExtractorApi.composable.unit.ts +++ b/src/components/feature-board-link-element/composables/MetaTagExtractorApi.composable.unit.ts @@ -33,7 +33,7 @@ describe("useMetaTagExtractorApi", () => { return { wrapper, composable }; }; - describe("getData", () => { + describe("extractMetaTags", () => { describe("when meta tags could be extracted", () => { const setup = () => { const mockedResponse: MetaTagExtractorResponse = { @@ -59,14 +59,14 @@ describe("useMetaTagExtractorApi", () => { it("should be defined", () => { const { composable } = setup(); - expect(composable?.getData).toBeDefined(); + expect(composable?.extractMetaTags).toBeDefined(); }); it("should return the data", async () => { const { composable, mockedResponse } = setup(); const url = "https://test.de/my-article"; - const data = await composable?.getData(url); + const data = await composable?.extractMetaTags(url); expect(data).toEqual(mockedResponse); }); @@ -96,7 +96,7 @@ describe("useMetaTagExtractorApi", () => { const { composable } = setup(); const url = "https://test.de/my-article"; - const data = await composable?.getData(url); + const data = await composable?.extractMetaTags(url); expect(data).toEqual({ url, title: "", description: "" }); }); diff --git a/src/components/feature-board-link-element/composables/PreviewGenerator.composable.unit.ts b/src/components/feature-board-link-element/composables/PreviewGenerator.composable.unit.ts index 92815930e4..8b101be230 100644 --- a/src/components/feature-board-link-element/composables/PreviewGenerator.composable.unit.ts +++ b/src/components/feature-board-link-element/composables/PreviewGenerator.composable.unit.ts @@ -30,7 +30,7 @@ describe("usePreviewGenerator", () => { return { wrapper, composable }; }; - describe("getData", () => { + describe("createPreviewImage", () => { describe("when meta tags could be extracted", () => { const setup = () => { const elementId = "my-custom-mocked-id";