X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Ffriends-basic.ts;h=31e180631f022ac23c994fc20986329ec80398a1;hb=571389d43b8fc8aaf27e77c06f19b320b08dbbc9;hp=13edf627312da7d75ff396eff470402a6e956be0;hpb=0e1dc3e7c69995c691e1dd82e3c2bc68748661ca;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/friends-basic.ts b/server/tests/api/friends-basic.ts index 13edf6273..31e180631 100644 --- a/server/tests/api/friends-basic.ts +++ b/server/tests/api/friends-basic.ts @@ -15,7 +15,8 @@ import { makeFriends, getFriendsList, dateIsValid, - quitOneFriend + quitOneFriend, + getPodsListPaginationAndSort } from '../utils' describe('Test basic friends', function () { @@ -86,7 +87,7 @@ describe('Test basic friends', function () { const pod1 = friends[0] expect(pod1.host).to.equal(servers[2].host) expect(pod1.email).to.equal('admin3@example.com') - expect(pod1.score).to.equal(20) + expect(pod1.score).to.be.at.least(20) expect(dateIsValid(pod1.createdAt)).to.be.true // Same here, the third pod should have the second pod as a friend @@ -98,7 +99,7 @@ describe('Test basic friends', function () { const pod2 = result[0] expect(pod2.host).to.equal(servers[1].host) expect(pod2.email).to.equal('admin2@example.com') - expect(pod2.score).to.equal(20) + expect(pod2.score).to.be.at.least(20) expect(dateIsValid(pod2.createdAt)).to.be.true // Finally the first pod make friend with the second pod @@ -120,6 +121,22 @@ describe('Test basic friends', function () { await makeFriends(server.url, server.accessToken, 409) }) + it('Should list friends correctly', async function () { + const start = 1 + const count = 1 + const sort = '-host' + + const res = await getPodsListPaginationAndSort(servers[0].url, start, count, sort) + expect(res.body.total).to.equal(2) + expect(res.body.data).to.have.lengthOf(1) + + const pod = res.body.data[0] + expect(pod.host).to.equal('localhost:9002') + expect(pod.email).to.equal('admin2@example.com') + expect(pod.score).to.be.at.least(20) + expect(dateIsValid(pod.createdAt)).to.be.true + }) + it('Should quit friends of pod 2', async function () { this.timeout(10000)