Skip to content

Commit c7c43bc

Browse files
committed
test(EditorInterface): Add integration test for update operation
1 parent 508c45c commit c7c43bc

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

lib/entities/editor-interface.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function createEditorInterfaceApi (http) {
2525
update: function () {
2626
const raw = this.toPlainObject()
2727
const data = omit(raw, ['sys'])
28-
return http.put(`content_types/${this.sys.contentType.id}/editor_interface`,
28+
return http.put(`content_types/${this.sys.contentType.sys.id}/editor_interface`,
2929
data,
3030
{
3131
headers: {'X-Contentful-Version': this.sys.version}

test/integration/content-type-integration.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,20 @@ export function contentTypeWriteTests (t, space) {
3939
t.ok(updatedContentType.isUpdated(), 'contentType is updated')
4040
t.equals(updatedContentType.fields[0].id, 'field', 'field id')
4141
t.ok(updatedContentType.getEditorInterface, 'updatedContentType.getEditorInterface')
42-
return updatedContentType.getEditorInterface()
43-
.then((response) => {
44-
t.ok(response.controls, 'editor interface controls')
45-
t.ok(response.sys, 'editor interface sys')
46-
return updatedContentType.unpublish()
47-
.then((unpublishedContentType) => {
48-
t.ok(unpublishedContentType.isDraft(), 'contentType is back in draft')
49-
return unpublishedContentType.delete()
42+
return updatedContentType.publish()
43+
.then((publishedContentType) => {
44+
return publishedContentType.getEditorInterface()
45+
.then((editorInterface) => {
46+
t.ok(editorInterface.controls, 'editor interface controls')
47+
t.ok(editorInterface.sys, 'editor interface sys')
48+
return editorInterface.update()
49+
.then((editorInterface) => {
50+
return updatedContentType.unpublish()
51+
.then((unpublishedContentType) => {
52+
t.ok(unpublishedContentType.isDraft(), 'contentType is back in draft')
53+
return unpublishedContentType.delete()
54+
})
55+
})
5056
})
5157
})
5258
})

0 commit comments

Comments
 (0)