/
sqlite3.js
43 lines (37 loc) · 1.08 KB
/
sqlite3.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var vows = require('vows');
var assert = require('assert');
var sqlite3 = require('sqlite3');
var dataType = require('../../lib/data_type');
vows.describe('sqlite3').addBatch({
'createTable': {
topic: new sqlite3.Database(':memory:'),
'using only column data types': {
topic: function(db) {
db.createTable('event', {
str: dataType.STRING,
txt: dataType.TEXT,
intg: dataType.INTEGER,
rel: dataType.REAL,
dt: dataType.DATE_TIME
}, this.callback);
},
'creates a table with the given columns and data types': function(err, db) {
assert.isNull(err);
}
},
'with not null column constraint': {
topic: function(db) {
db.createTable('event', {
str: dataType.STRING,
txt: dataType.TEXT,
intg: dataType.INTEGER,
rel: dataType.REAL,
dt: dataType.DATE_TIME
}, this.callback);
},
'creates a table with a non-nullible column': function(err, db) {
assert.isNull(err);
}
}
}
}).export(module);