Fix tests

This commit is contained in:
roschaefer 2019-11-16 20:20:37 +01:00
parent 978347ba7b
commit 5d570c24a7

View File

@ -18,10 +18,7 @@ const HumanConnectionOrg = fs.readFileSync(
path.join(__dirname, '../../../snapshots/embeds/HumanConnectionOrg.html'),
'utf8',
)
const pr960 = fs.readFileSync(
path.join(__dirname, '../../../snapshots/embeds/pr960.html'),
'utf8',
)
const pr960 = fs.readFileSync(path.join(__dirname, '../../../snapshots/embeds/pr960.html'), 'utf8')
const babyLovesCat = fs.readFileSync(
path.join(__dirname, '../../../snapshots/embeds/babyLovesCat.html'),
'utf8',
@ -98,7 +95,7 @@ describe('Query', () => {
html: null,
image: null,
lang: null,
publisher: 'YouTube',
publisher: null,
sources: ['resource'],
title: null,
type: 'link',
@ -106,9 +103,8 @@ describe('Query', () => {
video: null,
},
},
errors: undefined
}
)
errors: undefined,
})
})
})
@ -121,7 +117,7 @@ describe('Query', () => {
})
it('does not crash if embed provider returns invalid JSON', async () => {
const expected = expect.objectContaining({
await expect(embedAction(variables)).resolves.toMatchObject({
data: {
embed: {
audio: null,
@ -141,8 +137,8 @@ describe('Query', () => {
video: null,
},
},
errors: undefined,
})
await expect(embedAction(variables)).resolves.toEqual(expected)
})
})
@ -155,7 +151,7 @@ describe('Query', () => {
})
it('returns meta data even if no embed html can be retrieved', async () => {
const expected = expect.objectContaining({
await expect(embedAction(variables)).resolves.toMatchObject({
data: {
embed: {
type: 'link',
@ -175,8 +171,8 @@ describe('Query', () => {
html: null,
},
},
errors: undefined,
})
await expect(embedAction(variables)).resolves.toEqual(expected)
})
})
@ -189,7 +185,7 @@ describe('Query', () => {
})
it('returns meta data plus youtube iframe html', async () => {
const expected = expect.objectContaining({
await expect(embedAction(variables)).resolves.toMatchObject({
data: {
embed: {
type: 'video',
@ -209,8 +205,8 @@ describe('Query', () => {
'<iframe width="480" height="270" src="https://www.youtube.com/embed/qkdXAtO40Fo?start=18&feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>',
},
},
errors: undefined,
})
await expect(embedAction(variables)).resolves.toEqual(expected)
})
})
})