fix(config): allow get on config properties without key

This commit is contained in:
Hiroki Osame
2023-04-25 23:24:31 +09:00
parent e634c1482a
commit 4d7712f1e8
3 changed files with 29 additions and 17 deletions

View File

@@ -25,19 +25,6 @@ export default testSuite(({ describe }) => {
expect(stderr).toMatch('Invalid config property OPENAI_KEY: Must start with "sk-"');
});
await test('set config file', async () => {
await aicommits(['config', 'set', openAiToken]);
const configFile = await fs.readFile(configPath, 'utf8');
expect(configFile).toMatch(openAiToken);
});
await test('get config file', async () => {
const { stdout } = await aicommits(['config', 'get', 'OPENAI_KEY']);
expect(stdout).toBe(openAiToken);
});
await test('reading unknown config', async () => {
await fs.appendFile(configPath, 'UNKNOWN=1');
@@ -63,11 +50,26 @@ export default testSuite(({ describe }) => {
await aicommits(['config', 'set', timeout]);
const configFile = await fs.readFile(configPath, 'utf8');
expect(configFile).toMatch(timeout);
const get = await aicommits(['config', 'get', 'timeout']);
expect(get.stdout).toBe(timeout);
});
});
await test('set config file', async () => {
await aicommits(['config', 'set', openAiToken]);
const configFile = await fs.readFile(configPath, 'utf8');
expect(configFile).toMatch(openAiToken);
});
await test('get config file', async () => {
const { stdout } = await aicommits(['config', 'get', 'OPENAI_KEY']);
expect(stdout).toBe(openAiToken);
});
await fixture.rm();
});
});