Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/bounties/bounty-state-machine.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,27 @@ describe('bounty state machine', () => {
);
});

it('allows refund from open, funded, claimed, in_review, merged, and expired', () => {
it('allows refund from open, funded, claimed, in_review, and expired', () => {
for (const status of [
BountyStatus.OPEN,
BountyStatus.FUNDED,
BountyStatus.CLAIMED,
BountyStatus.IN_REVIEW,
BountyStatus.MERGED,
BountyStatus.EXPIRED,
]) {
expect(canTransition(status, BountyStatus.REFUNDED)).toBe(true);
}
});

it('disallows transition from MERGED to REFUNDED to prevent sponsor fund retraction (#795)', () => {
expect(canTransition(BountyStatus.MERGED, BountyStatus.REFUNDED)).toBe(
false,
);
expect(() =>
assertTransition(BountyStatus.MERGED, BountyStatus.REFUNDED),
).toThrow(InvalidBountyTransitionError);
});

it('disallows skipping states, e.g. open -> merged directly', () => {
expect(canTransition(BountyStatus.OPEN, BountyStatus.MERGED)).toBe(false);
});
Expand Down
1 change: 0 additions & 1 deletion src/bounties/bounty-state-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const BOUNTY_TRANSITIONS: Record<BountyStatus, BountyStatus[]> = {
[BountyStatus.MERGED]: [
BountyStatus.PAID,
BountyStatus.RELEASE_FAILED,
BountyStatus.REFUNDED,
],
[BountyStatus.RELEASE_FAILED]: [BountyStatus.MERGED, BountyStatus.REFUNDED],
[BountyStatus.PAID]: [],
Expand Down