skillhub/cli/test/unit/stores/credentials-store.test.ts
dongmucat 87dbf2686b fix(cli): resolve Windows CI test failures across three platform issues
- Use Bun.which() with process.execPath fallback in run-cli helper to
  resolve bun executable on Windows (fixes 22 integration tests)
- Normalize paths in credentials-store test for Windows backslash compat
- Use shell: true on Windows in updater spawn for proper exe resolution
2026-04-29 16:03:09 +08:00

15 lines
735 B
TypeScript

import { describe, expect, test } from 'bun:test'
import { normalize } from 'path'
import { createTempHome } from '../../helpers/temp-env'
import { CredentialsStore } from '../../../src/stores/credentials-store'
describe('CredentialsStore', () => {
test('stores tokens under user home .skillhub only', async () => {
const env = await createTempHome()
const store = new CredentialsStore(env.home)
await store.setToken('https://registry.example.com', 'sk_test')
expect(await store.getToken('https://registry.example.com')).toBe('sk_test')
expect(normalize(store.path)).toBe(normalize(`${env.home}/.skillhub/credentials.json`))
expect(await Bun.file(`${env.cwd}/credentials.json`).exists()).toBe(false)
})
})