beautyfiglet/test/test.ts

33 lines
996 B
TypeScript
Raw Normal View History

2025-01-14 17:34:16 +01:00
import { expect, tap } from '@push.rocks/tapbundle';
import * as beautyfiglet from '../ts/index.js';
2018-03-05 01:21:25 +01:00
2025-01-14 17:34:16 +01:00
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);
2025-01-14 17:34:16 +01:00
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);
2025-01-14 17:34:16 +01:00
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
2018-03-05 01:26:26 +01:00
});
2018-03-05 01:21:25 +01:00
2025-01-14 17:34:16 +01:00
tap.start();