mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Add test for content type func
This commit is contained in:
parent
e53cc28683
commit
51186a195f
1 changed files with 20 additions and 0 deletions
20
packages/api/test/utils/uploads.test.ts
Normal file
20
packages/api/test/utils/uploads.test.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import 'mocha'
|
||||
import { expect } from 'chai'
|
||||
import 'chai/register-should'
|
||||
import { contentReaderForPage } from '../../src/utils/uploads'
|
||||
import { ContentReader, PageType } from '../../src/generated/graphql'
|
||||
|
||||
describe('contentReaderForPage', () => {
|
||||
it('returns web if there is no uploadFileId', () => {
|
||||
const result = contentReaderForPage(PageType.Book, undefined)
|
||||
expect(result).to.eq(ContentReader.Web)
|
||||
})
|
||||
it('returns Epub if there is an uploadFileId and type is book', () => {
|
||||
const result = contentReaderForPage(PageType.Book, 'fakeUploadFileId')
|
||||
expect(result).to.eq(ContentReader.Epub)
|
||||
})
|
||||
it('returns PDF if there is an uploadFileId and type is not File', () => {
|
||||
const result = contentReaderForPage(PageType.File, 'fakeUploadFileId')
|
||||
expect(result).to.eq(ContentReader.Pdf)
|
||||
})
|
||||
})
|
||||
Loading…
Reference in a new issue