Skip to content

Commit

Permalink
test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
broofa committed Apr 26, 2024
1 parent b0fd186 commit 15525ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
5 changes: 2 additions & 3 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import {Buffer} from 'node:buffer';
import {expectType} from 'tsd';
import ansiEscapes from './index.js';

// Note: we don't test named exports here because the default export (which
// we're testing here) is just a composition of all the named exports. So if
// this test passes, we can safely assume the named exports are working.
// Note: As in test.js, only test the default export. Named exports are assumed
// to work if this passes.

expectType<string>(ansiEscapes.cursorTo(0));
expectType<string>(ansiEscapes.cursorTo(0, 1));
Expand Down
14 changes: 6 additions & 8 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import test from 'ava';
import ansiEscapes, { cursorTo } from './index.js';
import ansiEscapes from './index.js';

test('default export', t => {
// Note: we don't test named exports here because the default export (tested
// here) is just a composition of all the named exports. So if this test
// passes we can safely assume the named exports are working.

test('main', t => {
t.true(Object.keys(ansiEscapes).length > 0);
t.is(typeof ansiEscapes.cursorTo, 'function');
t.is(ansiEscapes.cursorTo(2, 2), '\u001B[3;3H');
});

test('named exports', t => {
t.true(Object.keys(ansiEscapes).length > 0);
t.is(typeof cursorTo, 'function');
t.is(cursorTo(2, 2), '\u001B[3;3H');
});

0 comments on commit 15525ea

Please sign in to comment.