Files
tsview/test/test.tsview.ts

44 lines
1.1 KiB
TypeScript

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).toEqual('function');
});
export default tap.start();