Skip to content
Open
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
21 changes: 21 additions & 0 deletions packages/cli-kit/src/public/node/abort.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {AbortController} from './abort.js'
import {describe, expect, test} from 'vitest'

describe('AbortController', () => {
test('correctly sets aborted state on the signal', () => {
const controller = new AbortController()
expect(controller.signal.aborted).toBe(false)

controller.abort()
expect(controller.signal.aborted).toBe(true)
})

test('correctly carries reason in the signal when aborted', () => {
const controller = new AbortController()
expect(controller.signal.reason).toBeUndefined()

const reason = 'test-reason'
controller.abort(reason)
expect(controller.signal.reason).toBe(reason)
})
})
Loading