diff --git a/packages/cli-kit/src/public/node/global-context.test.ts b/packages/cli-kit/src/public/node/global-context.test.ts new file mode 100644 index 00000000000..eaecf9a08d9 --- /dev/null +++ b/packages/cli-kit/src/public/node/global-context.test.ts @@ -0,0 +1,27 @@ +import {getCurrentCommandId, setCurrentCommandId} from './global-context.js' +import {afterEach, describe, expect, test} from 'vitest' + +describe('global-context', () => { + afterEach(() => { + setCurrentCommandId('') + }) + + test('getCurrentCommandId returns empty string by default', () => { + // When + const got = getCurrentCommandId() + + // Then + expect(got).toBe('') + }) + + test('setCurrentCommandId updates current command ID', () => { + // Given + const commandId = 'app:dev' + + // When + setCurrentCommandId(commandId) + + // Then + expect(getCurrentCommandId()).toBe('app:dev') + }) +})