Skip to content

Commit 9a855d8

Browse files
committed
fix tests
1 parent f74ed34 commit 9a855d8

File tree

4 files changed

+66
-1
lines changed

4 files changed

+66
-1
lines changed

packages/field-plugin/src/createFieldPlugin/createPluginActions/createPluginActions.test.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,29 @@ describe('createPluginActions', () => {
231231
field: 'dummy',
232232
callbackId: TEST_CALLBACK_ID,
233233
filename,
234+
fieldtype: 'asset',
235+
name: '',
236+
meta_data: {},
237+
title: '',
238+
copyright: '',
239+
focus: '',
240+
alt: '',
241+
source: '',
242+
is_private: false,
234243
})
235244
const result = await promise
236-
expect(result).toEqual({ filename })
245+
expect(result).toEqual({
246+
filename,
247+
fieldtype: 'asset',
248+
name: '',
249+
meta_data: {},
250+
title: '',
251+
copyright: '',
252+
focus: '',
253+
alt: '',
254+
source: '',
255+
is_private: false,
256+
})
237257
})
238258
it('does not call the callack function when callbackId does not match', async () => {
239259
const WRONG_CALLBACK_ID = TEST_CALLBACK_ID + '_wrong'
@@ -255,6 +275,15 @@ describe('createPluginActions', () => {
255275
field: 'dummy',
256276
callbackId: WRONG_CALLBACK_ID,
257277
filename,
278+
fieldtype: 'asset',
279+
name: '',
280+
meta_data: {},
281+
title: '',
282+
copyright: '',
283+
focus: '',
284+
alt: '',
285+
source: '',
286+
is_private: false,
258287
})
259288
const resolvedFn = jest.fn()
260289
const rejectedFn = jest.fn()

packages/field-plugin/src/createFieldPlugin/createPluginActions/createPluginMessageListener/handlePluginMessage.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ describe('handlePluginMessage', () => {
9595
filename: '/my-file.jpg',
9696
field: 'callback-uid',
9797
callbackId: 'test-callback-id',
98+
fieldtype: 'asset',
99+
name: '',
100+
meta_data: {},
101+
title: '',
102+
copyright: '',
103+
focus: '',
104+
alt: '',
105+
source: '',
106+
is_private: false,
98107
}
99108
const callbacks = mockCallbacks()
100109
handlePluginMessage(data, uid, callbacks)

packages/field-plugin/src/messaging/pluginMessage/containerToPluginMessage/Asset.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ import { AssetSelectedMessage } from './AssetSelectedMessage'
33

44
const stub: Asset = {
55
filename: 'https://somthing.com/myimage.jpg',
6+
fieldtype: 'asset',
7+
name: '',
8+
meta_data: {},
9+
title: '',
10+
copyright: '',
11+
focus: '',
12+
alt: '',
13+
source: '',
14+
is_private: false,
615
}
716

817
const assetSelectedMessage: AssetSelectedMessage = {
@@ -11,6 +20,15 @@ const assetSelectedMessage: AssetSelectedMessage = {
1120
callbackId: 'test-callback-id',
1221
action: 'asset-selected',
1322
filename: 'https://somthing.com/myimage.jpg',
23+
fieldtype: 'asset',
24+
name: '',
25+
meta_data: {},
26+
title: '',
27+
copyright: '',
28+
focus: '',
29+
alt: '',
30+
source: '',
31+
is_private: false,
1432
}
1533

1634
describe('Asset', function () {

packages/field-plugin/src/messaging/pluginMessage/containerToPluginMessage/AssetSelectedMessage.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ const stub: AssetSelectedMessage = {
1010
field: 'dummy-field',
1111
callbackId: 'test-callback-id',
1212
filename: 'https://somthing.com/myimage.jpg',
13+
fieldtype: 'asset',
14+
name: '',
15+
meta_data: {},
16+
title: '',
17+
copyright: '',
18+
focus: '',
19+
alt: '',
20+
source: '',
21+
is_private: false,
1322
}
1423

1524
describe('AssetSelectedMessage', function () {

0 commit comments

Comments
 (0)