test(npm): update tests for preset-based profile creation

- update postinstall tests to expect empty profiles
- add test verifying GLM/GLMT/Kimi not auto-created
- update CLI profile tests to handle optional profiles
- remove hardcoded GLM profile expectations
This commit is contained in:
kaitranntt committed 2025-12-20 19:50:40 -05:00
1 parent f96116d280
commit de45fa0da9
2 files changed
+26 -15

No files matched your search

+16 -7
View File
@@ -77,12 +77,21 @@ describe('npm CLI', () => {
});
describe('Profile handling', () => {
it('loads glm profile', function() {
// Note: GLM/GLMT/Kimi profiles are no longer auto-created (v6.0)
// Users create these via UI presets or CLI: ccs api create --preset glm
it('shows helpful error for non-existent profile', function() {
try {
runCli('glm --help', { stdio: 'pipe' });
// If GLM profile exists from previous setup, this is fine too
} catch (e) {
const output = e.stderr?.toString() || '';
assert(!output.includes("Profile 'glm' not found"), 'GLM profile should exist');
const output = e.stderr?.toString() || e.stdout?.toString() || '';
// Either profile exists and works, or shows helpful "not found" message
// Both are valid behaviors depending on user's setup
const isValid = !output.includes("Profile 'glm' not found") ||
output.includes("not found") ||
output.includes("ccs api create");
assert(isValid, 'Should either find profile or show helpful message');
}
});
@@ -96,13 +105,13 @@ describe('npm CLI', () => {
}
});
it('handles profile with flags', function() {
it('handles profile with flags correctly', function() {
try {
runCli('glm -c', { stdio: 'pipe', timeout: 3000 });
// Use a known command instead of profile that may not exist
runCli('api --help', { stdio: 'pipe', timeout: 3000 });
} catch (e) {
const output = e.stderr?.toString() || '';
assert(!output.includes("Profile 'glm' not found"), 'GLM profile should exist');
assert(!output.includes("Profile '-c' not found"), 'Should not treat -c as profile');
assert(!output.includes("Profile '-c' not found"), 'Should not treat flags as profiles');
}
});
});