beautyfiglet/test/test.ts

31 lines
953 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 = "Hello, World!";
const result = await testFiglet.renderDefault(text);
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);
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();