diff --git a/src/AnnotationThread.js b/src/AnnotationThread.js index d07a9ac2c..885a0c8af 100644 --- a/src/AnnotationThread.js +++ b/src/AnnotationThread.js @@ -585,7 +585,8 @@ class AnnotationThread extends EventEmitter { threadID: this.threadID }, message, - createdBy: this.api.user + createdBy: this.api.user, + thread: this.threadNumber }; } diff --git a/src/__tests__/AnnotationThread-test.js b/src/__tests__/AnnotationThread-test.js index e3e363ead..3422426a7 100644 --- a/src/__tests__/AnnotationThread-test.js +++ b/src/__tests__/AnnotationThread-test.js @@ -171,6 +171,28 @@ describe('AnnotationThread', () => { }); }); + describe('createAnnotationData()', () => { + it('should create an annotation data object to post to the API', () => { + const message = 'something'; + const type = 'point'; + const data = thread.createAnnotationData(type, message); + expect(data).toStrictEqual({ + item: { + type: 'file_version', + id: '1' + }, + details: { + type, + location: {}, + threadID: '2' + }, + message, + createdBy: { id: '1' }, + thread: '1' + }); + }); + }); + describe('updateTemporaryAnnotation()', () => { const tempAnnotation = { id: 1 }; const serverAnnotation = {