Skip to content

Commit

Permalink
fix(tests): test fixes for postgresql
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Nov 17, 2017
1 parent 4f0c035 commit 27ac971
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions test/unit/lucid-belongs-to-many.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1737,7 +1737,7 @@ test.group('Relations | Belongs To Many', (group) => {

const user = await User.find(20)
const postsCount = await user.posts().count('* as total')
assert.deepEqual(postsCount, [{ 'total': 2 }])
assert.deepEqual(postsCount, [{ 'total': helpers.formatNumber(2) }])
})

test('count distinct on given field', async (assert) => {
Expand All @@ -1762,7 +1762,7 @@ test.group('Relations | Belongs To Many', (group) => {

const user = await User.find(20)
const postsCount = await user.posts().countDistinct('post_user.user_id as total')
assert.deepEqual(postsCount, [{ 'total': 1 }])
assert.deepEqual(postsCount, [{ 'total': helpers.formatNumber(1) }])
})

test('withCount work fine with self relations', async (assert) => {
Expand Down
8 changes: 4 additions & 4 deletions test/unit/lucid.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ test.group('Model', (group) => {
}

const count = await ioc.use('Database').table('users').count('* as total')
assert.deepEqual(count, [{ 'total': 0 }])
assert.deepEqual(count, [{ 'total': helpers.formatNumber(0) }])
})

test('rollback update operation via transaction', async (assert) => {
Expand Down Expand Up @@ -1500,7 +1500,7 @@ test.group('Model', (group) => {
}

const count = await ioc.use('Database').table('users').count('* as total')
assert.deepEqual(count, [{ 'total': 0 }])
assert.deepEqual(count, [{ 'total': helpers.formatNumber(0) }])
})

test('createMany inside a transaction', async (assert) => {
Expand All @@ -1522,7 +1522,7 @@ test.group('Model', (group) => {
}

const count = await ioc.use('Database').table('users').count('* as total')
assert.deepEqual(count, [{ 'total': 0 }])
assert.deepEqual(count, [{ 'total': helpers.formatNumber(0) }])
})

test('define runtime visible fields', async (assert) => {
Expand Down Expand Up @@ -1611,7 +1611,7 @@ test.group('Model', (group) => {
assert.isTrue(user.$persisted)
assert.equal(user.username, 'foo')
assert.equal(user.vid, 2)
assert.equal(helpers.formatQuery(usersQuery.sql), helpers.formatQuery('insert into "users" ("created_at", "updated_at", "username", "vid") values (?, ?, ?, ?)'))
assert.equal(helpers.formatQuery(usersQuery.sql), helpers.formatQuery(helpers.addReturningStatement('insert into "users" ("created_at", "updated_at", "username", "vid") values (?, ?, ?, ?)', 'id')))
})

test('new up a row when old doesn\'t exists', async (assert) => {
Expand Down

0 comments on commit 27ac971

Please sign in to comment.