From ea58f885e2504f62b53206de9c411fb4d8647948 Mon Sep 17 00:00:00 2001 From: Emma Indal Date: Fri, 3 Jul 2020 11:17:15 +0200 Subject: [PATCH] fix(tests): fix fixures (#1505) Co-authored-by: Emma Indal --- .../reader/transformers/addBaseUrl.test.ts | 72 ++++++++++++------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/plugins/techdocs/src/reader/transformers/addBaseUrl.test.ts b/plugins/techdocs/src/reader/transformers/addBaseUrl.test.ts index 4b1477e9c0..8629dce0d3 100644 --- a/plugins/techdocs/src/reader/transformers/addBaseUrl.test.ts +++ b/plugins/techdocs/src/reader/transformers/addBaseUrl.test.ts @@ -63,52 +63,72 @@ describe('addBaseUrl', () => { }); it('includes path option without slash', () => { - const shadowDom = createTestShadowDom(FIXTURES.FIXTURE_STANDARD_PAGE, { - transformers: [ - addBaseUrl({ - docStorageURL: DOC_STORAGE_URL, - componentId: 'example-docs', - path: 'examplepath', - }), - ], - }); + const shadowDom = createTestShadowDom( + ` + + + + + + + `, + { + transformers: [ + addBaseUrl({ + docStorageURL: DOC_STORAGE_URL, + componentId: 'example-docs', + path: 'examplepath', + }), + ], + }, + ); expect(getSample(shadowDom, 'img', 'src')).toEqual([ - 'https://example-host.storage.googleapis.com/example-docs/examplepath/img/win-py-install.png', - 'https://example-host.storage.googleapis.com/example-docs/examplepath/img/initial-layout.png', + 'https://example-host.storage.googleapis.com/example-docs/img/win-py-install.png', + 'https://example-host.storage.googleapis.com/example-docs/img/initial-layout.png', ]); expect(getSample(shadowDom, 'link', 'href')).toEqual([ 'https://www.mkdocs.org/', - 'https://example-host.storage.googleapis.com/example-docs/examplepath/assets/images/favicon.png', + 'https://example-host.storage.googleapis.com/example-docs/assets/images/favicon.png', ]); expect(getSample(shadowDom, 'script', 'src')).toEqual([ 'https://www.google-analytics.com/analytics.js', - 'https://example-host.storage.googleapis.com/example-docs/examplepath/assets/javascripts/vendor.d710d30a.min.js', + 'https://example-host.storage.googleapis.com/example-docs/assets/javascripts/vendor.d710d30a.min.js', ]); }); it('includes path option with slash', () => { - const shadowDom = createTestShadowDom(FIXTURES.FIXTURE_STANDARD_PAGE, { - transformers: [ - addBaseUrl({ - docStorageURL: DOC_STORAGE_URL, - componentId: 'example-docs', - path: 'examplepath/', - }), - ], - }); + const shadowDom = createTestShadowDom( + ` + + + + + + + `, + { + transformers: [ + addBaseUrl({ + docStorageURL: DOC_STORAGE_URL, + componentId: 'example-docs', + path: 'examplepath/', + }), + ], + }, + ); expect(getSample(shadowDom, 'img', 'src')).toEqual([ - 'https://example-host.storage.googleapis.com/example-docs/examplepath/img/win-py-install.png', - 'https://example-host.storage.googleapis.com/example-docs/examplepath/img/initial-layout.png', + 'https://example-host.storage.googleapis.com/example-docs/img/win-py-install.png', + 'https://example-host.storage.googleapis.com/example-docs/img/initial-layout.png', ]); expect(getSample(shadowDom, 'link', 'href')).toEqual([ 'https://www.mkdocs.org/', - 'https://example-host.storage.googleapis.com/example-docs/examplepath/assets/images/favicon.png', + 'https://example-host.storage.googleapis.com/example-docs/assets/images/favicon.png', ]); expect(getSample(shadowDom, 'script', 'src')).toEqual([ 'https://www.google-analytics.com/analytics.js', - 'https://example-host.storage.googleapis.com/example-docs/examplepath/assets/javascripts/vendor.d710d30a.min.js', + 'https://example-host.storage.googleapis.com/example-docs/assets/javascripts/vendor.d710d30a.min.js', ]); }); });