Skip to content

Commit

Permalink
query/exists: +tx test.
Browse files Browse the repository at this point in the history
  • Loading branch information
StreetStrider committed Feb 9, 2017
1 parent 41b10bb commit 6708105
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/query/exists.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,40 @@ describe('query/exists', () =>
expect(e).equal(true)
})
})

it('works with tx', () =>
{
return ds
.then(ds =>
{
var dst = (tx) => ds().transacting(tx)

return kx.transaction(tx =>
{
return Promise.resolve()
.then(() =>
{
return exists(dst(tx).where('n', '>=', 10))
})
.then(e =>
{
expect(e).a('boolean')
expect(e).equal(false)
})
.then(() =>
{
return dst(tx).insert({ n: 11 })
})
.then(() =>
{
return exists(dst(tx).where('n', '>=', 10))
})
.then(e =>
{
expect(e).a('boolean')
expect(e).equal(true)
})
})
})
})
})

0 comments on commit 6708105

Please sign in to comment.