beautyfiglet/test/test.ts

33 lines
1000 B
TypeScript

import { expect, tap } from '@push.rocks/tapbundle';
import * as beautyfiglet from '../ts/index.js';
let testFiglet: typeof beautyfiglet.BeautyFiglet;
tap.test('setup', async () => {
testFiglet = beautyfiglet.BeautyFiglet;
expect(testFiglet).toBeTruthy();
});
tap.test('should render text with the default font', async () => {
const text = "serve.zone";
const result = await testFiglet.renderDefault(text, '');
console.log(result);
expect(result).toBeTruthy();
});
tap.test('should render text with a specific font', async () => {
const text = "Fancy Text";
const font = "Ghost";
const result = await testFiglet.renderText(text, font);
console.log(result);
expect(result).toBeTruthy();
});
tap.test('should list available fonts', async () => {
const fonts = await testFiglet.listFonts();
expect(Array.isArray(fonts)).toBeTrue();
expect(fonts.length).toBeGreaterThan(0);
expect(fonts).toContain("Standard"); // Ensure "Standard" is in the font list
});
tap.start();