mirror of
https://github.com/iflytek/skillhub.git
synced 2026-10-17 04:33:36 +00:00
The create-namespace dialog validates slugs client-side before sending the request, and its pattern was still ASCII-only. SlugValidator has accepted Unicode letters, numbers and symbols since #196, so the form rejected slugs the server accepts. Signed-off-by: D41910 <158550716+D41910@users.noreply.github.com>
27 lines
909 B
TypeScript
27 lines
909 B
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
import { stat } from 'node:fs/promises'
|
|
import { mkdtemp, writeFile } from 'node:fs/promises'
|
|
import { tmpdir } from 'node:os'
|
|
import { join } from 'node:path'
|
|
import { applyCredentialPermissions, userStateDir } from '../../../src/platform/paths'
|
|
|
|
describe('userStateDir', () => {
|
|
test('throws when home is empty string', () => {
|
|
expect(() => userStateDir('')).toThrow('Cannot resolve user home directory')
|
|
})
|
|
})
|
|
|
|
describe('applyCredentialPermissions', () => {
|
|
test('sets 0o600 on unix', async () => {
|
|
const tempDir = await mkdtemp(join(tmpdir(), 'skillhub-test-'))
|
|
const tempFile = join(tempDir, 'credential.json')
|
|
await writeFile(tempFile, '{}')
|
|
|
|
await applyCredentialPermissions(tempFile)
|
|
|
|
if (process.platform !== 'win32') {
|
|
const stats = await stat(tempFile)
|
|
expect(stats.mode & 0o777).toBe(0o600)
|
|
}
|
|
})
|
|
})
|