X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Ftests%2Fapi%2Fsearch%2Fsearch-activitypub-video-channels.ts;h=1f29f840a5aa5def010f6fa04612988036a6e674;hb=bf54587a3e2ad9c2c186828f2a5682b91ee2cc00;hp=426cbc8e1bec1f61eb4489c2a69d1280b3e344fb;hpb=9e8789497377cac5554a622da605f5b89587aa9c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts index 426cbc8e1..1f29f840a 100644 --- a/server/tests/api/search/search-activitypub-video-channels.ts +++ b/server/tests/api/search/search-activitypub-video-channels.ts @@ -10,7 +10,7 @@ import { setAccessTokensToServers, wait, waitJobs -} from '@shared/extra-utils' +} from '@shared/server-commands' import { VideoChannel } from '@shared/models' const expect = chai.expect @@ -64,7 +64,7 @@ describe('Test ActivityPub video channels search', function () { this.timeout(15000) { - const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server3' + const search = servers[1].url + '/video-channels/channel1_server3' const body = await command.searchChannels({ search, token: servers[0].accessToken }) expect(body.total).to.equal(0) @@ -74,7 +74,7 @@ describe('Test ActivityPub video channels search', function () { { // Without token - const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2' + const search = servers[1].url + '/video-channels/channel1_server2' const body = await command.searchChannels({ search }) expect(body.total).to.equal(0) @@ -85,7 +85,7 @@ describe('Test ActivityPub video channels search', function () { it('Should search a local video channel', async function () { const searches = [ - 'http://localhost:' + servers[0].port + '/video-channels/channel1_server1', + servers[0].url + '/video-channels/channel1_server1', 'channel1_server1@localhost:' + servers[0].port ] @@ -101,7 +101,7 @@ describe('Test ActivityPub video channels search', function () { }) it('Should search a local video channel with an alternative URL', async function () { - const search = 'http://localhost:' + servers[0].port + '/c/channel1_server1' + const search = servers[0].url + '/c/channel1_server1' for (const token of [ undefined, servers[0].accessToken ]) { const body = await command.searchChannels({ search, token }) @@ -114,11 +114,30 @@ describe('Test ActivityPub video channels search', function () { } }) + it('Should search a local video channel with a query in URL', async function () { + const searches = [ + servers[0].url + '/video-channels/channel1_server1', + servers[0].url + '/c/channel1_server1' + ] + + for (const search of searches) { + for (const token of [ undefined, servers[0].accessToken ]) { + const body = await command.searchChannels({ search: search + '?param=2', token }) + + expect(body.total).to.equal(1) + expect(body.data).to.be.an('array') + expect(body.data).to.have.lengthOf(1) + expect(body.data[0].name).to.equal('channel1_server1') + expect(body.data[0].displayName).to.equal('Channel 1 server 1') + } + } + }) + it('Should search a remote video channel with URL or handle', async function () { const searches = [ - 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2', - 'http://localhost:' + servers[1].port + '/c/channel1_server2', - 'http://localhost:' + servers[1].port + '/c/channel1_server2/videos', + servers[1].url + '/video-channels/channel1_server2', + servers[1].url + '/c/channel1_server2', + servers[1].url + '/c/channel1_server2/videos', 'channel1_server2@localhost:' + servers[1].port ] @@ -178,7 +197,7 @@ describe('Test ActivityPub video channels search', function () { // Expire video channel await wait(10000) - const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2' + const search = servers[1].url + '/video-channels/channel1_server2' const body = await command.searchChannels({ search, token: servers[0].accessToken }) expect(body.total).to.equal(1) expect(body.data).to.have.lengthOf(1) @@ -201,7 +220,7 @@ describe('Test ActivityPub video channels search', function () { // Expire video channel await wait(10000) - const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2' + const search = servers[1].url + '/video-channels/channel1_server2' await command.searchChannels({ search, token: servers[0].accessToken }) await waitJobs(servers) @@ -223,7 +242,7 @@ describe('Test ActivityPub video channels search', function () { // Expire video await wait(10000) - const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2' + const search = servers[1].url + '/video-channels/channel1_server2' const body = await command.searchChannels({ search, token: servers[0].accessToken }) expect(body.total).to.equal(0) expect(body.data).to.have.lengthOf(0)