Skip to content

Commit

Permalink
test(pg-v5): remove unexpected / fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fivetanley committed Jan 5, 2021
1 parent 47a15b5 commit fd789b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/pg-v5/commands/ps.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ WHERE
ORDER BY query_start DESC
`

yield psql.exec(db, query)
const output = yield psql.exec(db, query)
process.stdout.write(output)
}

module.exports = {
Expand Down
6 changes: 3 additions & 3 deletions packages/pg-v5/test/commands/ps.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('pg:ps', () => {

it('runs query', async () => {
await cmd.run({ app: 'myapp', args: {}, flags: {} })
expect(removeEmptyLines(psql._query.trim())).to.equal(removeEmptyLines(`SELECT
expect(removeEmptyLines(psql._query)).to.equal(removeEmptyLines(`SELECT
pid,
state,
application_name AS source,
Expand All @@ -71,7 +71,7 @@ WHERE

it('runs verbose query', async () => {
await cmd.run({ app: 'myapp', args: {}, flags: { verbose: true } })
expect(removeEmptyLines(psql._query.trim())).to.equal(removeEmptyLines(`SELECT
expect(removeEmptyLines(psql._query)).to.equal(removeEmptyLines(`SELECT
pid,
state,
application_name AS source,
Expand All @@ -91,5 +91,5 @@ WHERE
})

function removeEmptyLines (string) {
return string.split('\n').filter(str => str.trim().length > 0).join('\n')
return string.toString().split('\n').map(str => str.trim()).filter(str => str.length > 0).join('\n')
}

0 comments on commit fd789b1

Please sign in to comment.