Connection tokens are now stored in OS keychain (or encrypted file fallback) instead of plaintext JSON. Existing plaintext tokens auto-migrate on first load.
37 lines
1.5 KiB
TypeScript
37 lines
1.5 KiB
TypeScript
import { assertEquals, assertExists } from 'https://deno.land/std@0.208.0/assert/mod.ts';
|
|
import { BaseProvider, GiteaProvider, GitLabProvider } from '../ts/providers/index.ts';
|
|
import { ConnectionManager } from '../ts/classes/connectionmanager.ts';
|
|
import { GitopsApp } from '../ts/classes/gitopsapp.ts';
|
|
import { StorageManager } from '../ts/storage/index.ts';
|
|
import * as smartsecret from '@push.rocks/smartsecret';
|
|
|
|
Deno.test('GiteaProvider instantiates correctly', () => {
|
|
const provider = new GiteaProvider('test-id', 'https://gitea.example.com', 'test-token');
|
|
assertExists(provider);
|
|
assertEquals(provider.connectionId, 'test-id');
|
|
assertEquals(provider.baseUrl, 'https://gitea.example.com');
|
|
});
|
|
|
|
Deno.test('GitLabProvider instantiates correctly', () => {
|
|
const provider = new GitLabProvider('test-id', 'https://gitlab.example.com', 'test-token');
|
|
assertExists(provider);
|
|
assertEquals(provider.connectionId, 'test-id');
|
|
assertEquals(provider.baseUrl, 'https://gitlab.example.com');
|
|
});
|
|
|
|
Deno.test('ConnectionManager instantiates correctly', () => {
|
|
const storage = new StorageManager({ backend: 'memory' });
|
|
const secret = new smartsecret.SmartSecret({ service: 'gitops-test' });
|
|
const manager = new ConnectionManager(storage, secret);
|
|
assertExists(manager);
|
|
});
|
|
|
|
Deno.test('GitopsApp instantiates correctly', () => {
|
|
const app = new GitopsApp();
|
|
assertExists(app);
|
|
assertExists(app.storageManager);
|
|
assertExists(app.smartSecret);
|
|
assertExists(app.connectionManager);
|
|
assertExists(app.opsServer);
|
|
});
|