-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: enhance query options, instance type, and toJSON() result type (#…
…207) * docs: enhance query options, instance type, and toJSON() result type * docs: driver.query dts
- Loading branch information
Showing
10 changed files
with
162 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ coverage | |
docs/Gemfile.lock | ||
package-lock.json | ||
.DS_Store | ||
test/types/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { strict as assert } from 'assert'; | ||
import { Bone, connect } from '../..' | ||
|
||
describe('=> Querying (TypeScript)', function() { | ||
class Post extends Bone { | ||
static table = 'articles' | ||
} | ||
|
||
before(async function() { | ||
Bone.driver = null; | ||
await connect({ | ||
dialect: 'sqlite', | ||
database: '/tmp/leoric.sqlite3', | ||
models: [ Post ], | ||
}); | ||
}); | ||
|
||
beforeEach(async function() { | ||
await Post.truncate(); | ||
}); | ||
|
||
describe('=> Driver', function() { | ||
it('driver.query(SELECT)', async function() { | ||
const { rows } = await Bone.driver.query('SELECT 1'); | ||
assert.equal(rows.length, 1); | ||
}); | ||
|
||
it('driver.query(INSERT)', async function() { | ||
const { insertId, affectedRows } = await Bone.driver.query( | ||
'INSERT INTO articles (title) VALUES ("Leah")' | ||
); | ||
assert.equal(affectedRows, 1); | ||
assert.ok(insertId); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.