Update test
This commit is contained in:
@ -10,7 +10,10 @@ import {
|
||||
SubscriptionStatus,
|
||||
SubscriptionType,
|
||||
} from '../../src/generated/graphql'
|
||||
import { UNSUBSCRIBE_EMAIL_TEXT } from '../../src/services/subscriptions'
|
||||
import {
|
||||
UNSUBSCRIBE_EMAIL_TEXT,
|
||||
unsubscribe,
|
||||
} from '../../src/services/subscriptions'
|
||||
import * as sendEmail from '../../src/utils/sendEmail'
|
||||
import { createTestSubscription, createTestUser, deleteTestUser } from '../db'
|
||||
import { graphqlRequest, request } from '../util'
|
||||
@ -134,23 +137,28 @@ describe('Subscriptions API', () => {
|
||||
undefined,
|
||||
SubscriptionType.Rss
|
||||
)
|
||||
await createTestSubscription(
|
||||
user,
|
||||
'sub_6',
|
||||
undefined,
|
||||
SubscriptionStatus.Unsubscribed,
|
||||
undefined,
|
||||
SubscriptionType.Newsletter
|
||||
)
|
||||
const allSubscriptions = [sub5, ...subscriptions]
|
||||
const res = await graphqlRequest(query, authToken).expect(200)
|
||||
|
||||
expect(res.body.data.subscriptions.subscriptions).to.eql(
|
||||
allSubscriptions.map((sub) => ({
|
||||
id: sub.id,
|
||||
name: sub.name,
|
||||
}))
|
||||
)
|
||||
try {
|
||||
await createTestSubscription(
|
||||
user,
|
||||
'sub_6',
|
||||
undefined,
|
||||
SubscriptionStatus.Unsubscribed,
|
||||
undefined,
|
||||
SubscriptionType.Newsletter
|
||||
)
|
||||
const allSubscriptions = [sub5, ...subscriptions]
|
||||
const res = await graphqlRequest(query, authToken).expect(200)
|
||||
|
||||
expect(res.body.data.subscriptions.subscriptions).to.eql(
|
||||
allSubscriptions.map((sub) => ({
|
||||
id: sub.id,
|
||||
name: sub.name,
|
||||
}))
|
||||
)
|
||||
} finally {
|
||||
unsubscribe(sub5)
|
||||
}
|
||||
})
|
||||
|
||||
it('should not return other users subscriptions', async () => {
|
||||
|
||||
Reference in New Issue
Block a user