Skip to content

Commit

Permalink
Fix: Ensure thread number is persisted for annotation replies (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
pramodsum authored Dec 4, 2018
1 parent 441f0f2 commit 734fc6c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/AnnotationThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,8 @@ class AnnotationThread extends EventEmitter {
threadID: this.threadID
},
message,
createdBy: this.api.user
createdBy: this.api.user,
thread: this.threadNumber
};
}

Expand Down
22 changes: 22 additions & 0 deletions src/__tests__/AnnotationThread-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 734fc6c

Please sign in to comment.