Skip to content

Commit

Permalink
feat(publish-quota): per user publishArticle quota
Browse files Browse the repository at this point in the history
resolves #3842
  • Loading branch information
49659410+tx0c committed May 30, 2024
1 parent 4d11ac9 commit df1ad89
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/types/__test__/1/article.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,30 @@ describe('publish article', () => {
expect(publishState).toBe(PUBLISH_STATE.pending)
expect(article).toBeNull()
})
test('publish again should trigger rate limit', async () => {
jest.setTimeout(10000)
const draft = {
title: Math.random().toString(),
content: Math.random().toString(),
}
const { id } = await putDraft({ draft }, connections)
const { publishState, article } = await publishArticle({ id }, connections)
expect(publishState).toBe(PUBLISH_STATE.pending)
expect(article).toBeNull()

const { id: nextDraftId } = await putDraft(
{
draft: {
title: Math.random().toString(),
content: Math.random().toString(),
},
},
connections
)
const res2Publish = await publishArticle({ id }, connections)
expect(res2Publish.publishState).toBe(PUBLISH_STATE.pending)
expect(res2Publish.article).toBeNull()
})

test('create a draft & publish with iscn', async () => {
jest.setTimeout(10000)
Expand Down

0 comments on commit df1ad89

Please sign in to comment.