Skip to content

Commit

Permalink
test: another attempt at fixing assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Sep 21, 2024
1 parent d44a351 commit 5251515
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 27 deletions.
4 changes: 2 additions & 2 deletions modules/dumper/dumper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ export class Dumper {
* Whitespace between the title and the link to align them
* on each side of x axis
*/
const whiteSpaceLength = columns ? columns - link.length - title.length - 4 : 1
const whiteSpace = new Array(whiteSpaceLength <= 0 ? 1 : whiteSpaceLength).join(' ')
const whiteSpaceLength = columns ? columns - link.length - title.length - 4 : 2
const whiteSpace = new Array(whiteSpaceLength <= 0 ? 2 : whiteSpaceLength).join(' ')

/**
* Styled heading with background color and bold text
Expand Down
38 changes: 13 additions & 25 deletions tests/dumper/dumper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,33 +71,21 @@ test.group('Dumper', () => {
} catch (error) {
await error.render(error, ace)

console.log(ace.ui.logger.getLogs()[0].message)
console.log(
dumper.dumpToAnsi(
{ hello: 'world' },
{
title: 'DUMP DIE',
source: {
location: fileURLToPath(new URL('', import.meta.url)),
line: 70,
},
}
)
)

assert.lengthOf(ace.ui.logger.getLogs(), 1)
assert.include(
ace.ui.logger.getLogs()[0].message,
dumper.dumpToAnsi(
{ hello: 'world' },
{
title: 'DUMP DIE',
source: {
location: fileURLToPath(new URL('', import.meta.url)),
line: 70,
},
}
)
ace.ui.logger.getLogs()[0].message.toLowerCase(),
dumper
.dumpToAnsi(
{ hello: 'world' },
{
title: 'DUMP DIE',
source: {
location: fileURLToPath(new URL('', import.meta.url)),
line: 70,
},
}
)
.toLowerCase()
)
}
})
Expand Down

0 comments on commit 5251515

Please sign in to comment.