forked from shippableSamples/sample_node_mysql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
25 lines (24 loc) · 675 Bytes
/
test.js
File metadata and controls
25 lines (24 loc) · 675 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var db = require('./index.js').db,
expect = require('chai').expect;
describe('MySql Database', function () {
it('should create the things table', function () {
db.schema.hasTable('things').then(function (exists) {
expect(exists).to.equal(true);
});
});
it('should save a new name', function () {
db('things')
.insert({ name: 'Johnson' })
.exec(function (err) {
expect(err).to.equal(null);
});
});
it('should retrieve that name', function () {
db('things')
.where({ name: 'Johnson' })
.select('name')
.then(function (name) {
expect(name[0].name).to.equal('Johnson');
});
});
});