import * as chai from 'chai'
import 'mocha'
-import { createUser, doubleFollow, flushAndRunMultipleServers, follow, getVideosList, unfollow, updateVideo, userLogin } from '../../utils'
-import { killallServers, ServerInfo, uploadVideo } from '../../utils/index'
-import { setAccessTokensToServers } from '../../utils/users/login'
+import {
+ createUser,
+ doubleFollow,
+ flushAndRunMultipleServers,
+ follow,
+ getVideosList,
+ unfollow,
+ updateVideo,
+ userLogin
+} from '../../../../shared/utils'
+import { killallServers, ServerInfo, uploadVideo } from '../../../../shared/utils/index'
+import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
import { Video, VideoChannel } from '../../../../shared/models/videos'
-import { waitJobs } from '../../utils/server/jobs'
+import { waitJobs } from '../../../../shared/utils/server/jobs'
import {
addUserSubscription,
listUserSubscriptions,
listUserSubscriptionVideos,
removeUserSubscription,
- getUserSubscription
-} from '../../utils/users/user-subscriptions'
+ getUserSubscription, areSubscriptionsExist
+} from '../../../../shared/utils/users/user-subscriptions'
const expect = chai.expect
}
})
+ it('Should return the existing subscriptions', async function () {
+ const uris = [
+ 'user3_channel@localhost:9003',
+ 'root2_channel@localhost:9001',
+ 'root_channel@localhost:9001',
+ 'user3_channel@localhost:9001'
+ ]
+
+ const res = await areSubscriptionsExist(servers[ 0 ].url, users[ 0 ].accessToken, uris)
+ const body = res.body
+
+ expect(body['user3_channel@localhost:9003']).to.be.true
+ expect(body['root2_channel@localhost:9001']).to.be.false
+ expect(body['root_channel@localhost:9001']).to.be.true
+ expect(body['user3_channel@localhost:9001']).to.be.false
+ })
+
it('Should list subscription videos', async function () {
{
const res = await listUserSubscriptionVideos(servers[0].url, servers[0].accessToken)