bobo.yang b2bd118e33 feat: Update tests and remove deprecated tests for Claude3 integration
- Comment out mocha imports in various tests to prep for new test strategy
- Replace `before` with `beforeEach` and `after` with `afterEach` for consistency
- Remove deprecated `commandsBase.test.ts` and `dtm.test.ts` files to reflect focus on new functionality
2024-03-10 16:36:28 +08:00

31 lines
870 B
TypeScript

// test/apiKey.test.ts
import { expect } from 'chai';
import { ApiKeyManager } from '../../src/util/apiKey';
import { UiUtilWrapper } from '../../src/util/uiUtil';
import sinon from 'sinon';
describe('ApiKeyManager', () => {
afterEach(() => {
sinon.restore();
delete process.env.OPENAI_API_KEY;
delete process.env.OPENAI_API_BASE;
});
describe('getKeyType', () => {
it('should return "sk" for sk keys', () => {
const keyType = ApiKeyManager.getKeyType('sk-key');
expect(keyType).to.equal('sk');
});
it('should return "DC" for DC keys', () => {
const keyType = ApiKeyManager.getKeyType('DC.key');
expect(keyType).to.equal('DC');
});
it('should return undefined for invalid keys', () => {
const keyType = ApiKeyManager.getKeyType('invalid.key');
expect(keyType).to.be.undefined;
});
});
});