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
34db7bb2d8
commit
8b848912c9
10 changed files with 20 additions and 24 deletions
|
|
@ -15,7 +15,7 @@ export const mochaGlobalTeardown = async () => {
|
|||
console.log('redis connection closed')
|
||||
|
||||
if (redisDataSource.workerRedisClient) {
|
||||
stopWorker()
|
||||
await stopWorker()
|
||||
console.log('worker closed')
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ describe('Sanitize Directive', () => {
|
|||
})
|
||||
|
||||
describe('Update user with a bio that is too long', () => {
|
||||
let bio = ''.padStart(500, '*')
|
||||
const bio = ''.padStart(500, '*')
|
||||
let query: string
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ describe('Emails Router', () => {
|
|||
user = await createTestUser('fakeUser')
|
||||
|
||||
newsletterEmail = await createNewsletterEmail(user.id)
|
||||
token = process.env.PUBSUB_VERIFICATION_TOKEN!
|
||||
token = process.env.PUBSUB_VERIFICATION_TOKEN || ''
|
||||
receivedEmail = await saveReceivedEmail(
|
||||
from,
|
||||
newsletterEmail.address,
|
||||
|
|
@ -52,7 +52,7 @@ describe('Emails Router', () => {
|
|||
describe('forward', () => {
|
||||
const html = '<html>test html</html>'
|
||||
|
||||
beforeEach(async () => {
|
||||
beforeEach(() => {
|
||||
sinon.replace(
|
||||
sendNotification,
|
||||
'sendMulticastPushNotifications',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { request } from '../util'
|
||||
import 'mocha'
|
||||
import { request } from '../util'
|
||||
|
||||
describe('Upload Router', () => {
|
||||
const token = process.env.PUBSUB_VERIFICATION_TOKEN || ''
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import 'mocha'
|
||||
import { expect } from 'chai'
|
||||
import 'mocha'
|
||||
import { validateUrl } from '../../src/services/create_page_save_request'
|
||||
|
||||
describe('validateUrl', () => {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import 'mocha'
|
||||
import { expect } from 'chai'
|
||||
import 'mocha'
|
||||
import { getHighlightLocation } from '../../src/services/highlights'
|
||||
|
||||
describe('getHighlightLocation', () => {
|
||||
let patch: string
|
||||
let location: number
|
||||
|
||||
before(async () => {
|
||||
before(() => {
|
||||
location = 109
|
||||
patch = `@@ -${location + 1},16 +${location + 1},36 @@
|
||||
. We're
|
||||
|
|
@ -18,7 +18,7 @@ describe('getHighlightLocation', () => {
|
|||
coming`
|
||||
})
|
||||
|
||||
it('returns highlight location from patch', async () => {
|
||||
it('returns highlight location from patch', () => {
|
||||
const result = getHighlightLocation(patch)
|
||||
expect(result).to.eql(location)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export const stopApolloServer = async () => {
|
|||
await apollo.stop()
|
||||
}
|
||||
|
||||
export const startWorker = async (connection: ConnectionOptions) => {
|
||||
export const startWorker = (connection: ConnectionOptions) => {
|
||||
worker = createWorker(connection)
|
||||
queueEvents = new QueueEvents(QUEUE_NAME, {
|
||||
connection,
|
||||
|
|
@ -28,8 +28,8 @@ export const startWorker = async (connection: ConnectionOptions) => {
|
|||
}
|
||||
|
||||
export const stopWorker = async () => {
|
||||
queueEvents.close()
|
||||
worker.close()
|
||||
await queueEvents.close()
|
||||
await worker.close()
|
||||
}
|
||||
|
||||
export const waitUntilJobsDone = async (jobs: Job[]) => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import 'mocha'
|
||||
import { expect } from 'chai'
|
||||
import 'mocha'
|
||||
import { validatedDate } from '../../src/utils/helpers'
|
||||
|
||||
describe('validatedDate', () => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
import 'mocha'
|
||||
import * as chai from 'chai'
|
||||
import { expect } from 'chai'
|
||||
import chaiAsPromised from 'chai-as-promised'
|
||||
import fs from 'fs'
|
||||
import 'mocha'
|
||||
import nock from 'nock'
|
||||
import { User } from '../../src/entity/user'
|
||||
import { deleteUser } from '../../src/services/user'
|
||||
import {
|
||||
getTitleFromEmailSubject,
|
||||
isProbablyArticle,
|
||||
|
|
@ -9,11 +13,7 @@ import {
|
|||
parsePageMetadata,
|
||||
parsePreparedContent,
|
||||
} from '../../src/utils/parser'
|
||||
import nock from 'nock'
|
||||
import chaiAsPromised from 'chai-as-promised'
|
||||
import { User } from '../../src/entity/user'
|
||||
import { createTestUser } from '../db'
|
||||
import { deleteUser } from '../../src/services/user'
|
||||
|
||||
chai.use(chaiAsPromised)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,6 @@
|
|||
"compilerOptions": {
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": [
|
||||
"src",
|
||||
"test",
|
||||
"../integration-handler/test/integrations.test.ts"
|
||||
],
|
||||
"exclude": ["./src/generated", "./test"]
|
||||
"include": ["src", "test"],
|
||||
"exclude": ["./src/generated"]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue