From c31c5f0f876162a3535dfe9260f76b89f2564bb8 Mon Sep 17 00:00:00 2001 From: gonzaloriestra <14979109+gonzaloriestra@users.noreply.github.com> Date: Wed, 9 Sep 2026 00:26:20 +0000 Subject: [PATCH] [Tests] Add unit tests for global-context module --- .../src/public/node/global-context.test.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 packages/cli-kit/src/public/node/global-context.test.ts 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') + }) +})