Skip to content

Commit 5b84d8b

Browse files
committed
Create a styles test for styles.js
1 parent dd5b3c5 commit 5b84d8b

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

styles.test.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// import {describe, it} from 'node:test';
2+
import assert from 'node:assert/strict';
3+
import {jest} from '@jest/globals';
4+
import util from 'node:util';
5+
import {style} from './styles.js';
6+
util.inspect.defaultOptions.depth = null; // show full objects
7+
// util.inspect.defaultOptions.depth = 0; // show truncated objects
8+
// util.inspect.defaultOptions.compact = true; // dont break objects to new lines
9+
// util.inspect.defaultOptions.compact = false; // break objects to new lines
10+
11+
// suppress jests tracing console logs
12+
import console from 'console';
13+
const jestConsole = console;
14+
15+
beforeEach(() => {
16+
global.console = console;
17+
console.log(style.color(255,0,255),'▷',style.reset,style.color(39),expect.getState().currentTestName,style.reset,'\n'); });
18+
19+
afterEach(() => {
20+
global.console = jestConsole;
21+
console.log(style.color(99), style.hr.double, style.reset);
22+
});
23+
24+
const logItDescription = (description, callback) => {
25+
console.log(style.green, ' ☞ ', style.reset,description);
26+
it(description, callback);
27+
};
28+
29+
const logCategory = (description, callback) => {
30+
console.log(style.color(255,0,255),'▷',style.reset,style.color(39),description,style.reset);
31+
describe(description, callback);
32+
};
33+
34+
const logDescribe = (description, callback) => {
35+
console.log('\n', style.orange,' ▷',style.reset,style.color(39),description,style.reset);
36+
describe(description, callback);
37+
};
38+
39+
40+
describe('styles', () => {
41+
it('should display style test', () => {
42+
style.test();
43+
});
44+
45+
it('should display style help', () => {
46+
style.help();
47+
});
48+
49+
});
50+
51+

0 commit comments

Comments
 (0)