Skip to content

Commit f55aff9

Browse files
committed
test message
1 parent 42de6be commit f55aff9

6 files changed

Lines changed: 118 additions & 203 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const consolePrinter = require('console-table-printer');
2+
3+
describe('console-table-printer exports', () => {
4+
test('should export Table class', () => {
5+
expect(consolePrinter.Table).toBeDefined();
6+
expect(typeof consolePrinter.Table).toBe('function');
7+
8+
// Test instantiation
9+
const table = new consolePrinter.Table();
10+
expect(table).toBeInstanceOf(consolePrinter.Table);
11+
expect(typeof table.addRow).toBe('function');
12+
expect(typeof table.addRows).toBe('function');
13+
expect(typeof table.printTable).toBe('function');
14+
});
15+
16+
test('should export printTable function', () => {
17+
expect(consolePrinter.printTable).toBeDefined();
18+
expect(typeof consolePrinter.printTable).toBe('function');
19+
});
20+
});
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const wcswidth = require('simple-wcswidth');
2+
3+
describe('simple-wcswidth exports', () => {
4+
test('should export wcswidth function', () => {
5+
expect(wcswidth.wcswidth).toBeDefined();
6+
expect(typeof wcswidth.wcswidth).toBe('function');
7+
8+
// Test functionality
9+
expect(wcswidth.wcswidth('hello')).toBe(5);
10+
expect(wcswidth.wcswidth('你好')).toBe(4);
11+
expect(wcswidth.wcswidth('こんにちは')).toBe(10);
12+
expect(wcswidth.wcswidth('안녕하세요')).toBe(10);
13+
});
14+
15+
test('should export wcwidth function', () => {
16+
expect(wcswidth.wcwidth).toBeDefined();
17+
expect(typeof wcswidth.wcwidth).toBe('function');
18+
19+
// Test functionality with character codes
20+
expect(wcswidth.wcwidth('a'.charCodeAt(0))).toBe(1);
21+
expect(wcswidth.wcwidth('你'.charCodeAt(0))).toBe(2);
22+
expect(wcswidth.wcwidth('こ'.charCodeAt(0))).toBe(2);
23+
expect(wcswidth.wcwidth('안'.charCodeAt(0))).toBe(2);
24+
});
25+
});

tests/integration/combined.test.js

Lines changed: 0 additions & 119 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Table } from 'console-table-printer';
2+
3+
describe('console-table-printer TypeScript exports', () => {
4+
test('should export Table class with correct type', () => {
5+
// Test instantiation with TypeScript types
6+
const table: Table = new Table();
7+
expect(table).toBeInstanceOf(Table);
8+
9+
// Test with basic config
10+
const configTable: Table = new Table({
11+
title: 'Test Table'
12+
});
13+
expect(configTable).toBeInstanceOf(Table);
14+
});
15+
16+
test('should have correct Table methods', () => {
17+
const table = new Table();
18+
19+
// Check that the Table class has the expected methods
20+
expect(typeof table.addRow).toBe('function');
21+
expect(typeof table.addRows).toBe('function');
22+
expect(typeof table.printTable).toBe('function');
23+
24+
// Test the methods
25+
table.addRow({ id: 1, name: 'Test' });
26+
table.addRows([
27+
{ id: 2, name: 'Test 2' },
28+
{ id: 3, name: 'Test 3' }
29+
]);
30+
31+
// If this compiles, the types are correct
32+
expect(true).toBe(true);
33+
});
34+
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { wcswidth, wcwidth } from 'simple-wcswidth';
2+
3+
describe('simple-wcswidth TypeScript exports', () => {
4+
test('should export wcswidth function with correct type', () => {
5+
// Check that wcswidth is a function
6+
expect(typeof wcswidth).toBe('function');
7+
8+
// Test functionality with TypeScript types
9+
const width1: number = wcswidth('hello');
10+
expect(width1).toBe(5);
11+
12+
const width2: number = wcswidth('你好');
13+
expect(width2).toBe(4);
14+
15+
const width3: number = wcswidth('こんにちは');
16+
expect(width3).toBe(10);
17+
18+
const width4: number = wcswidth('안녕하세요');
19+
expect(width4).toBe(10);
20+
});
21+
22+
test('should export wcwidth function with correct type', () => {
23+
// Check that wcwidth is a function
24+
expect(typeof wcwidth).toBe('function');
25+
26+
// Test functionality with TypeScript types
27+
const width1: number = wcwidth('a'.charCodeAt(0));
28+
expect(width1).toBe(1);
29+
30+
const width2: number = wcwidth('你'.charCodeAt(0));
31+
expect(width2).toBe(2);
32+
33+
const width3: number = wcwidth('こ'.charCodeAt(0));
34+
expect(width3).toBe(2);
35+
36+
const width4: number = wcwidth('안'.charCodeAt(0));
37+
expect(width4).toBe(2);
38+
});
39+
});

tests/typescript/integration/combined.test.ts

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)