initial
This commit is contained in:
43
test/test.tsview.ts
Normal file
43
test/test.tsview.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as tsview from '../ts/index.js';
|
||||
|
||||
tap.test('should export TsView class', async () => {
|
||||
expect(tsview.TsView).toBeDefined();
|
||||
});
|
||||
|
||||
tap.test('should create TsView instance', async () => {
|
||||
const viewer = new tsview.TsView();
|
||||
expect(viewer).toBeInstanceOf(tsview.TsView);
|
||||
expect(viewer.config).toBeDefined();
|
||||
});
|
||||
|
||||
tap.test('should have config methods', async () => {
|
||||
const viewer = new tsview.TsView();
|
||||
|
||||
// Set S3 config
|
||||
viewer.setS3Config({
|
||||
endpoint: 'localhost',
|
||||
port: 9000,
|
||||
accessKey: 'test',
|
||||
accessSecret: 'test',
|
||||
useSsl: false,
|
||||
});
|
||||
|
||||
expect(viewer.config.hasS3()).toBeTrue();
|
||||
expect(viewer.config.hasMongo()).toBeFalse();
|
||||
|
||||
// Set MongoDB config
|
||||
viewer.setMongoConfig({
|
||||
mongoDbUrl: 'mongodb://localhost:27017',
|
||||
mongoDbName: 'test',
|
||||
});
|
||||
|
||||
expect(viewer.config.hasMongo()).toBeTrue();
|
||||
});
|
||||
|
||||
tap.test('should have runCli export', async () => {
|
||||
expect(tsview.runCli).toBeDefined();
|
||||
expect(typeof tsview.runCli).toBe('function');
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
Reference in New Issue
Block a user