X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fclient.ts;h=6c32c81db813851dc7184c5796c907dd454db66d;hb=40a8c0a4c4f654ba720ece6219816ad9c4fb9f5e;hp=9c27a7aae0d17de25e7d28981112d93a4209ea85;hpb=4c7e60bc17ee5830399bac4aa273356903421b4c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/client.ts b/server/tests/client.ts index 9c27a7aae..6c32c81db 100644 --- a/server/tests/client.ts +++ b/server/tests/client.ts @@ -24,7 +24,10 @@ function checkIndexTags (html: string, title: string, description: string, css: expect(html).to.contain('') const htmlConfig: HTMLServerConfig = omit(config, 'signup') - expect(html).to.contain(``) + const configObjectString = JSON.stringify(htmlConfig) + const configEscapedString = JSON.stringify(configObjectString) + + expect(html).to.contain(``) } describe('Test a client controllers', function () { @@ -119,7 +122,7 @@ describe('Test a client controllers', function () { const port = servers[0].port const expectedLink = '` expect(res.text).to.contain(expectedLink) @@ -140,7 +143,7 @@ describe('Test a client controllers', function () { const port = servers[0].port const expectedLink = '` expect(res.text).to.contain(expectedLink) @@ -178,7 +181,7 @@ describe('Test a client controllers', function () { expect(text).to.contain(``) expect(text).to.contain(``) expect(text).to.contain('') - expect(text).to.contain(``) + expect(text).to.contain(``) } async function watchPlaylistPageTest (path: string) { @@ -188,7 +191,7 @@ describe('Test a client controllers', function () { expect(text).to.contain(``) expect(text).to.contain(``) expect(text).to.contain('') - expect(text).to.contain(``) + expect(text).to.contain(``) } it('Should have valid Open Graph tags on the account page', async function () { @@ -445,6 +448,50 @@ describe('Test a client controllers', function () { } } }) + + it('Should add noindex meta tag for remote accounts', async function () { + const handle = 'root@' + servers[0].host + const paths = [ '/accounts/', '/a/', '/@' ] + + for (const path of paths) { + { + const { text } = await makeHTMLRequest(servers[1].url, path + handle) + expect(text).to.contain('') + } + + { + const { text } = await makeHTMLRequest(servers[0].url, path + handle) + expect(text).to.not.contain('') + } + } + }) + + it('Should add noindex meta tag for remote accounts', async function () { + const handle = 'root_channel@' + servers[0].host + const paths = [ '/video-channels/', '/c/', '/@' ] + + for (const path of paths) { + { + const { text } = await makeHTMLRequest(servers[1].url, path + handle) + expect(text).to.contain('') + } + + { + const { text } = await makeHTMLRequest(servers[0].url, path + handle) + expect(text).to.not.contain('') + } + } + }) + + it('Should add noindex header for some paths', async function () { + const paths = [ '/about/peertube' ] + + for (const path of paths) { + const { headers } = await makeHTMLRequest(servers[0].url, path) + + expect(headers['x-robots-tag']).to.equal('noindex') + } + }) }) describe('Embed HTML', function () {