Skip to content

Commit 4dcccf2

Browse files
committedNov 4, 2021
Fix tests
1 parent caf497f commit 4dcccf2

12 files changed

+20
-70
lines changed
 

‎test/direct-100-hard-tabbed.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
import {basename} from 'node:path'
22
import {fileURLToPath} from 'node:url'
33
import {readFileSync} from 'node:fs'
4-
import {promisify} from 'node:util'
5-
import {exec} from 'node:child_process'
64
import test from 'ava'
75
import {truwrap} from '../index.js'
86

9-
const execPromise = promisify(exec)
10-
117
const width = basename(fileURLToPath(import.meta.url), '.js').split('-')[1] // 10, 20, 40, 60, 80, 100
128

139
const tabbed = readFileSync('test/fixtures/in/tabbed.txt').toString()
1410

1511
for (const right of [0, 1, 5]) {
1612
for (const left of [0, 1, 2, 5, 10]) {
17-
test(`Direct: Hard wrap tabbed source to w${width} l${left} r${right}`, async t => {
13+
test(`Direct: Hard wrap tabbed source to w${width} l${left} r${right}`, t => {
1814
const renderer = truwrap({
1915
left,
2016
right,
2117
width,
22-
mode: 'hard'
18+
mode: 'hard',
2319
})
2420
renderer.write(tabbed)
2521
t.snapshot(renderer.end())

‎test/direct-100-hard.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
import {basename} from 'node:path'
22
import {fileURLToPath} from 'node:url'
33
import {readFileSync} from 'node:fs'
4-
import {promisify} from 'node:util'
5-
import {exec} from 'node:child_process'
64
import test from 'ava'
75
import {truwrap} from '../index.js'
86

9-
const execPromise = promisify(exec)
10-
117
const width = basename(fileURLToPath(import.meta.url), '.js').split('-')[1] // 10, 20, 40, 60, 80, 100
128

139
const lorem = readFileSync('test/fixtures/in/lorem.txt').toString()
1410

1511
for (const right of [0, 1, 5]) {
1612
for (const left of [0, 1, 2, 5, 10]) {
17-
test(`Direct: Hard wrap to w${width} l${left} r${right}`, async t => {
13+
test(`Direct: Hard wrap to w${width} l${left} r${right}`, t => {
1814
const renderer = truwrap({
1915
left,
2016
right,
2117
width,
22-
mode: 'hard'
18+
mode: 'hard',
2319
})
2420
renderer.write(lorem)
2521
t.snapshot(renderer.end())

‎test/direct-100-keep.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
import {basename} from 'node:path'
22
import {fileURLToPath} from 'node:url'
33
import {readFileSync} from 'node:fs'
4-
import {promisify} from 'node:util'
5-
import {exec} from 'node:child_process'
64
import test from 'ava'
75
import {truwrap} from '../index.js'
86

9-
const execPromise = promisify(exec)
10-
117
const width = basename(fileURLToPath(import.meta.url), '.js').split('-')[1] // 10, 20, 40, 60, 80, 100
128

13-
const lorem = readFileSync('test/fixtures/in/lorem.txt').toString()
149
const ls = readFileSync('test/fixtures/in/ls.txt').toString()
1510

1611
for (const right of [0, 1, 5]) {
1712
for (const left of [0, 1, 2, 5, 10]) {
18-
test(`Direct: Keep wrap to w${width} l${left} r${right}`, async t => {
13+
test(`Direct: Keep wrap to w${width} l${left} r${right}`, t => {
1914
const renderer = truwrap({
2015
left,
2116
right,
2217
width,
23-
mode: 'keep'
18+
mode: 'keep',
2419
})
2520
renderer.write(ls)
2621
t.snapshot(renderer.end())

‎test/direct-100-panel.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
11
import {basename} from 'node:path'
22
import {fileURLToPath} from 'node:url'
33
import {readFileSync} from 'node:fs'
4-
import {promisify} from 'node:util'
5-
import {exec} from 'node:child_process'
64
import test from 'ava'
75
import {truwrap, parsePanel} from '../index.js'
86

9-
const execPromise = promisify(exec)
10-
117
const width = basename(fileURLToPath(import.meta.url), '.js').split('-')[1] // 10, 20, 40, 60, 80, 100
128

139
const panel = readFileSync('test/fixtures/in/panel.txt').toString()
1410

1511
if ([40, 60, 80, 100].includes(Number(width))) {
16-
test(`Direct: Panel w${width} l0 r0`, async t => {
12+
test(`Direct: Panel w${width} l0 r0`, t => {
1713
const renderer = truwrap({
1814
left: 0,
1915
right: 0,
2016
width,
21-
mode: 'soft'
17+
mode: 'soft',
2218
})
2319
const panelSource = parsePanel(panel, '|', renderer.getWidth())
2420
const panelOptions = {
2521
maxLineWidth: renderer.getWidth(),
2622
showHeaders: false,
2723
truncate: false,
28-
config: panelSource.configuration
24+
config: panelSource.configuration,
2925
}
3026
renderer.panel(panelSource.content, panelOptions)
3127
t.snapshot(renderer.end())

‎test/direct-100-soft-tabbed.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
import {basename} from 'node:path'
22
import {fileURLToPath} from 'node:url'
33
import {readFileSync} from 'node:fs'
4-
import {promisify} from 'node:util'
5-
import {exec} from 'node:child_process'
64
import test from 'ava'
75
import {truwrap} from '../index.js'
86

9-
const execPromise = promisify(exec)
10-
117
const width = basename(fileURLToPath(import.meta.url), '.js').split('-')[1] // 10, 20, 40, 60, 80, 100
128

13-
const lorem = readFileSync('test/fixtures/in/lorem.txt').toString()
149
const tabbed = readFileSync('test/fixtures/in/tabbed.txt').toString()
1510

1611
for (const right of [0, 1, 5]) {
1712
for (const left of [0, 1, 2, 5, 10]) {
18-
test(`Direct: Soft wrap tabbed source to w${width} l${left} r${right}`, async t => {
13+
test(`Direct: Soft wrap tabbed source to w${width} l${left} r${right}`, t => {
1914
const renderer = truwrap({
2015
left,
2116
right,
2217
width,
23-
mode: 'soft'
18+
mode: 'soft',
2419
})
2520
renderer.write(tabbed)
2621
t.snapshot(renderer.end())

‎test/direct-100-soft.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
import {basename} from 'node:path'
22
import {fileURLToPath} from 'node:url'
33
import {readFileSync} from 'node:fs'
4-
import {promisify} from 'node:util'
5-
import {exec} from 'node:child_process'
64
import test from 'ava'
75
import {truwrap} from '../index.js'
86

9-
const execPromise = promisify(exec)
10-
117
const width = basename(fileURLToPath(import.meta.url), '.js').split('-')[1] // 10, 20, 40, 60, 80, 100
128

139
const lorem = readFileSync('test/fixtures/in/lorem.txt').toString()
1410

1511
for (const right of [0, 1, 5]) {
1612
for (const left of [0, 1, 2, 5, 10]) {
17-
test(`Direct: Soft wrap to w${width} l${left} r${right}`, async t => {
13+
test(`Direct: Soft wrap to w${width} l${left} r${right}`, t => {
1814
const renderer = truwrap({
1915
left,
2016
right,
2117
width,
22-
mode: 'soft'
18+
mode: 'soft',
2319
})
2420
renderer.write(lorem)
2521
t.snapshot(renderer.end())

‎test/stream-100-hard-tabbed.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ import {basename} from 'node:path'
22
import {fileURLToPath} from 'node:url'
33
import {readFileSync} from 'node:fs'
44
import {PassThrough} from 'node:stream'
5-
import {promisify} from 'node:util'
6-
import {exec} from 'node:child_process'
75
import test from 'ava'
86
import {truwrap} from '../index.js'
97

10-
const execPromise = promisify(exec)
11-
128
const width = basename(fileURLToPath(import.meta.url), '.js').split('-')[1] // 10, 20, 40, 60, 80, 100
139

1410
const tabbed = readFileSync('test/fixtures/in/tabbed.txt').toString()
@@ -24,7 +20,7 @@ for (const right of [0, 1, 5]) {
2420
right,
2521
width,
2622
mode: 'hard',
27-
outStream: StreamProxy
23+
outStream: StreamProxy,
2824
})
2925

3026
const buffered = await new Promise(resolve => {

‎test/stream-100-hard.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ import {basename} from 'node:path'
22
import {fileURLToPath} from 'node:url'
33
import {readFileSync} from 'node:fs'
44
import {PassThrough} from 'node:stream'
5-
import {promisify} from 'node:util'
6-
import {exec} from 'node:child_process'
75
import test from 'ava'
86
import {truwrap} from '../index.js'
97

10-
const execPromise = promisify(exec)
11-
128
const width = basename(fileURLToPath(import.meta.url), '.js').split('-')[1] // 10, 20, 40, 60, 80, 100
139

1410
const lorem = readFileSync('test/fixtures/in/lorem.txt').toString()
@@ -24,7 +20,7 @@ for (const right of [0, 1, 5]) {
2420
right,
2521
width,
2622
mode: 'hard',
27-
outStream: StreamProxy
23+
outStream: StreamProxy,
2824
})
2925

3026
const buffered = await new Promise(resolve => {

‎test/stream-100-keep.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ import {basename} from 'node:path'
22
import {fileURLToPath} from 'node:url'
33
import {readFileSync} from 'node:fs'
44
import {PassThrough} from 'node:stream'
5-
import {promisify} from 'node:util'
6-
import {exec} from 'node:child_process'
75
import test from 'ava'
86
import {truwrap} from '../index.js'
97

10-
const execPromise = promisify(exec)
11-
128
const width = basename(fileURLToPath(import.meta.url), '.js').split('-')[1] // 10, 20, 40, 60, 80, 100
139

1410
const ls = readFileSync('test/fixtures/in/ls.txt').toString()
@@ -24,7 +20,7 @@ for (const right of [0, 1, 5]) {
2420
right,
2521
width,
2622
mode: 'keep',
27-
outStream: StreamProxy
23+
outStream: StreamProxy,
2824
})
2925

3026
const buffered = await new Promise(resolve => {

‎test/stream-100-panel.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ import {basename} from 'node:path'
22
import {fileURLToPath} from 'node:url'
33
import {readFileSync} from 'node:fs'
44
import {PassThrough} from 'node:stream'
5-
import {promisify} from 'node:util'
6-
import {exec} from 'node:child_process'
75
import test from 'ava'
86
import {truwrap, parsePanel} from '../index.js'
97

10-
const execPromise = promisify(exec)
11-
128
const width = basename(fileURLToPath(import.meta.url), '.js').split('-')[1] // 10, 20, 40, 60, 80, 100
139

1410
const panel = readFileSync('test/fixtures/in/panel.txt').toString()
@@ -23,7 +19,7 @@ if ([40, 60, 80, 100].includes(Number(width))) {
2319
right: 0,
2420
width,
2521
mode: 'soft',
26-
outStream: StreamProxy
22+
outStream: StreamProxy,
2723
})
2824

2925
const panelSource = parsePanel(panel, '|', renderer.getWidth())
@@ -32,7 +28,7 @@ if ([40, 60, 80, 100].includes(Number(width))) {
3228
maxLineWidth: renderer.getWidth(),
3329
showHeaders: false,
3430
truncate: false,
35-
config: panelSource.configuration
31+
config: panelSource.configuration,
3632
}
3733

3834
const buffered = await new Promise(resolve => {

‎test/stream-100-soft-tabbed.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ import {basename} from 'node:path'
22
import {fileURLToPath} from 'node:url'
33
import {readFileSync} from 'node:fs'
44
import {PassThrough} from 'node:stream'
5-
import {promisify} from 'node:util'
6-
import {exec} from 'node:child_process'
75
import test from 'ava'
86
import {truwrap} from '../index.js'
97

10-
const execPromise = promisify(exec)
11-
128
const width = basename(fileURLToPath(import.meta.url), '.js').split('-')[1] // 10, 20, 40, 60, 80, 100
139

1410
const tabbed = readFileSync('test/fixtures/in/tabbed.txt').toString()
@@ -24,7 +20,7 @@ for (const right of [0, 1, 5]) {
2420
right,
2521
width,
2622
mode: 'soft',
27-
outStream: StreamProxy
23+
outStream: StreamProxy,
2824
})
2925

3026
const buffered = await new Promise(resolve => {

‎test/stream-100-soft.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ import {basename} from 'node:path'
22
import {fileURLToPath} from 'node:url'
33
import {readFileSync} from 'node:fs'
44
import {PassThrough} from 'node:stream'
5-
import {promisify} from 'node:util'
6-
import {exec} from 'node:child_process'
75
import test from 'ava'
86
import {truwrap} from '../index.js'
97

10-
const execPromise = promisify(exec)
11-
128
const width = basename(fileURLToPath(import.meta.url), '.js').split('-')[1] // 10, 20, 40, 60, 80, 100
139

1410
const lorem = readFileSync('test/fixtures/in/lorem.txt').toString()
@@ -24,7 +20,7 @@ for (const right of [0, 1, 5]) {
2420
right,
2521
width,
2622
mode: 'soft',
27-
outStream: StreamProxy
23+
outStream: StreamProxy,
2824
})
2925

3026
const buffered = await new Promise(resolve => {

0 commit comments

Comments
 (0)
Please sign in to comment.