Skip to content

Commit

Permalink
feat: comment status
Browse files Browse the repository at this point in the history
  • Loading branch information
andipaetzold committed Oct 31, 2023
1 parent 2be5cb5 commit f9c0354
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 4 additions & 2 deletions lib/entities/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ export type RichTextBodyProperty = 'rich-text'
export type RichTextBodyFormat = { bodyFormat: RichTextBodyProperty }
export type PlainTextBodyFormat = { bodyFormat?: PlainTextBodyProperty }

export type CommentStatus = 'active' | 'resolved'

export type CommentProps = {
sys: CommentSysProps
body: string
status: 'resolved' | 'active'
status: CommentStatus
}

export type CreateCommentProps = Omit<CommentProps, 'sys'>
export type CreateCommentProps = Omit<CommentProps, 'sys' | 'status'> & { status?: CommentStatus }
export type UpdateCommentProps = Omit<CommentProps, 'sys'> & {
sys: Pick<CommentSysProps, 'version'>
}
Expand Down
16 changes: 12 additions & 4 deletions lib/plain/plain-client-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ describe('Plain Client', () => {
})

it('should create a update object', async () => {
await plainClient.comment.update(props, { body: updateText, sys: { version: 2 } })
await plainClient.comment.update(props, {
body: updateText,
sys: { version: 2 },
status: 'active',
})
expect(stub).to.have.been.calledWithMatch({
entityType: 'Comment',
action: 'update',
Expand Down Expand Up @@ -162,18 +166,22 @@ describe('Plain Client', () => {
entityType: 'Comment',
action: 'create',
params: props,
payload: { body: richTextBody },
payload: { body: richTextBody, status: 'active' },
headers: undefined,
})
})

it('should create a update object', async () => {
await plainClient.comment.update(props, { body: richTextBody, sys: { version: 2 } })
await plainClient.comment.update(props, {
body: richTextBody,
sys: { version: 2 },
status: 'active',
})
expect(stub).to.have.been.calledWithMatch({
entityType: 'Comment',
action: 'update',
params: props,
payload: { body: richTextBody },
payload: { body: richTextBody, status: 'active' },
headers: undefined,
})
})
Expand Down

0 comments on commit f9c0354

Please sign in to comment.