mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Fix tests
This commit is contained in:
parent
978347ba7b
commit
5d570c24a7
@ -18,10 +18,7 @@ const HumanConnectionOrg = fs.readFileSync(
|
|||||||
path.join(__dirname, '../../../snapshots/embeds/HumanConnectionOrg.html'),
|
path.join(__dirname, '../../../snapshots/embeds/HumanConnectionOrg.html'),
|
||||||
'utf8',
|
'utf8',
|
||||||
)
|
)
|
||||||
const pr960 = fs.readFileSync(
|
const pr960 = fs.readFileSync(path.join(__dirname, '../../../snapshots/embeds/pr960.html'), 'utf8')
|
||||||
path.join(__dirname, '../../../snapshots/embeds/pr960.html'),
|
|
||||||
'utf8',
|
|
||||||
)
|
|
||||||
const babyLovesCat = fs.readFileSync(
|
const babyLovesCat = fs.readFileSync(
|
||||||
path.join(__dirname, '../../../snapshots/embeds/babyLovesCat.html'),
|
path.join(__dirname, '../../../snapshots/embeds/babyLovesCat.html'),
|
||||||
'utf8',
|
'utf8',
|
||||||
@ -98,7 +95,7 @@ describe('Query', () => {
|
|||||||
html: null,
|
html: null,
|
||||||
image: null,
|
image: null,
|
||||||
lang: null,
|
lang: null,
|
||||||
publisher: 'YouTube',
|
publisher: null,
|
||||||
sources: ['resource'],
|
sources: ['resource'],
|
||||||
title: null,
|
title: null,
|
||||||
type: 'link',
|
type: 'link',
|
||||||
@ -106,9 +103,8 @@ describe('Query', () => {
|
|||||||
video: null,
|
video: null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
errors: undefined
|
errors: undefined,
|
||||||
}
|
})
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -121,7 +117,7 @@ describe('Query', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('does not crash if embed provider returns invalid JSON', async () => {
|
it('does not crash if embed provider returns invalid JSON', async () => {
|
||||||
const expected = expect.objectContaining({
|
await expect(embedAction(variables)).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
embed: {
|
embed: {
|
||||||
audio: null,
|
audio: null,
|
||||||
@ -141,8 +137,8 @@ describe('Query', () => {
|
|||||||
video: null,
|
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 () => {
|
it('returns meta data even if no embed html can be retrieved', async () => {
|
||||||
const expected = expect.objectContaining({
|
await expect(embedAction(variables)).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
embed: {
|
embed: {
|
||||||
type: 'link',
|
type: 'link',
|
||||||
@ -175,8 +171,8 @@ describe('Query', () => {
|
|||||||
html: null,
|
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 () => {
|
it('returns meta data plus youtube iframe html', async () => {
|
||||||
const expected = expect.objectContaining({
|
await expect(embedAction(variables)).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
embed: {
|
embed: {
|
||||||
type: 'video',
|
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>',
|
'<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)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user