mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Fix tests
This commit is contained in:
parent
69968e5288
commit
e512ba0bad
3 changed files with 19 additions and 16 deletions
|
|
@ -1,3 +1,8 @@
|
|||
import { ILike } from 'typeorm'
|
||||
import { NewsletterEmail } from '../../entity/newsletter_email'
|
||||
import { ReceivedEmail } from '../../entity/received_email'
|
||||
import { getRepository } from '../../entity/utils'
|
||||
import { env } from '../../env'
|
||||
import {
|
||||
MarkEmailAsItemError,
|
||||
MarkEmailAsItemErrorCode,
|
||||
|
|
@ -7,15 +12,11 @@ import {
|
|||
RecentEmailsErrorCode,
|
||||
RecentEmailsSuccess,
|
||||
} from '../../generated/graphql'
|
||||
import { authorized } from '../../utils/helpers'
|
||||
import { getRepository } from '../../entity/utils'
|
||||
import { ReceivedEmail } from '../../entity/received_email'
|
||||
import { updateReceivedEmail } from '../../services/received_emails'
|
||||
import { saveNewsletterEmail } from '../../services/save_newsletter_email'
|
||||
import { NewsletterEmail } from '../../entity/newsletter_email'
|
||||
import { authorized } from '../../utils/helpers'
|
||||
import { generateUniqueUrl, parseEmailAddress } from '../../utils/parser'
|
||||
import { sendEmail } from '../../utils/sendEmail'
|
||||
import { env } from '../../env'
|
||||
import { ILike } from 'typeorm'
|
||||
|
||||
export const recentEmailsResolver = authorized<
|
||||
RecentEmailsSuccess,
|
||||
|
|
@ -114,6 +115,8 @@ export const markEmailAsItemResolver = authorized<
|
|||
},
|
||||
newsletterEmail
|
||||
)
|
||||
// update received email type
|
||||
await updateReceivedEmail(recentEmail.id, 'article')
|
||||
|
||||
const text = `A recent email marked as a library item
|
||||
by: ${claims.uid}
|
||||
|
|
|
|||
|
|
@ -40,16 +40,22 @@ describe('create user', () => {
|
|||
const testUser = 'testuser'
|
||||
|
||||
const adminUser = await createTestUser(testOwner)
|
||||
const admninIds = [adminUser.id]
|
||||
const [, invite] = await createGroup({
|
||||
admin: adminUser,
|
||||
name: 'testgroup',
|
||||
})
|
||||
const user = await createTestUser(testUser, invite.code)
|
||||
const userIds = [user.id]
|
||||
|
||||
expect(await getUserFollowers(user)).to.eql([adminUser])
|
||||
expect(await getUserFollowing(user)).to.eql([adminUser])
|
||||
expect(await getUserFollowers(adminUser)).to.eql([user])
|
||||
expect(await getUserFollowing(adminUser)).to.eql([user])
|
||||
const userFollowers = await getUserFollowers(user)
|
||||
const userFollowing = await getUserFollowing(user)
|
||||
const adminUserFollowers = await getUserFollowers(adminUser)
|
||||
const adminUserFollowing = await getUserFollowing(adminUser)
|
||||
expect(userFollowers.map(u => u.id)).to.eql(admninIds)
|
||||
expect(userFollowing.map(u => u.id)).to.eql(admninIds)
|
||||
expect(adminUserFollowers.map(u => u.id)).to.eql(userIds)
|
||||
expect(adminUserFollowing.map(u => u.id)).to.eql(userIds)
|
||||
})
|
||||
|
||||
it('creates profile when user exists but profile not', async () => {
|
||||
|
|
|
|||
|
|
@ -80,12 +80,6 @@ describe('saveNewsletterEmail', () => {
|
|||
newsletterEmail: { id: newsletterEmail.id },
|
||||
})
|
||||
expect(subscriptions).not.to.be.empty
|
||||
|
||||
// check if the received email was updated
|
||||
const updatedReceivedEmail = await getRepository(ReceivedEmail).findOneBy({
|
||||
id: receivedEmail.id,
|
||||
})
|
||||
expect(updatedReceivedEmail?.type).to.equal('article')
|
||||
})
|
||||
|
||||
it('adds a Newsletter label to that page', async () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue