Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
jnewland committed May 24, 2024
1 parent 4380426 commit f544f2c
Showing 1 changed file with 30 additions and 16 deletions.
46 changes: 30 additions & 16 deletions __tests__/required.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ describe('required', () => {
statusName: 'Required'
})

expect(mockOctokit.rest.repos.createCommitStatus).toHaveBeenCalledWith(expect.objectContaining({
state: 'success',
description: 'All required workflows have succeeded.'
}))
expect(mockOctokit.rest.repos.createCommitStatus).toHaveBeenCalledWith(
expect.objectContaining({
state: 'success',
description: 'All required workflows have succeeded.'
})
)
})

it('should handle only one of the required statuses reporting success', async () => {
Expand All @@ -79,10 +81,14 @@ describe('required', () => {
statusName: 'Required'
})

expect(mockOctokit.rest.repos.createCommitStatus).toHaveBeenCalledWith(expect.objectContaining({
state: 'pending',
description: expect.stringContaining('required workflows are still pending...')
}))
expect(mockOctokit.rest.repos.createCommitStatus).toHaveBeenCalledWith(
expect.objectContaining({
state: 'pending',
description: expect.stringContaining(
'required workflows are still pending...'
)
})
)
})

it('should handle one of the required statuses reporting failure', async () => {
Expand All @@ -104,10 +110,14 @@ describe('required', () => {
statusName: 'Required'
})

expect(mockOctokit.rest.repos.createCommitStatus).toHaveBeenCalledWith(expect.objectContaining({
state: 'failure',
description: expect.stringContaining('required workflows were not successful.')
}))
expect(mockOctokit.rest.repos.createCommitStatus).toHaveBeenCalledWith(
expect.objectContaining({
state: 'failure',
description: expect.stringContaining(
'required workflows were not successful.'
)
})
)
})

it('should handle replication lag scenario', async () => {
Expand All @@ -129,9 +139,13 @@ describe('required', () => {
statusName: 'Required'
})

expect(mockOctokit.rest.repos.createCommitStatus).toHaveBeenCalledWith(expect.objectContaining({
state: 'pending',
description: expect.stringContaining('Waiting for conclusion to be reported for Test Workflow...')
}))
expect(mockOctokit.rest.repos.createCommitStatus).toHaveBeenCalledWith(
expect.objectContaining({
state: 'pending',
description: expect.stringContaining(
'Waiting for conclusion to be reported for Test Workflow...'
)
})
)
})
})

0 comments on commit f544f2c

Please sign in to comment.