add NeDB support
This commit is contained in:
20
test/test.js
20
test/test.js
File diff suppressed because one or more lines are too long
23
test/test.ts
23
test/test.ts
@ -89,7 +89,7 @@ describe('smartdata', function () {
|
||||
should(testCarInstance.collection).be.instanceof(smartdata.DbCollection)
|
||||
should(testCarInstance).be.instanceof(smartdata.DbDoc)
|
||||
testCarInstance.save()
|
||||
it('should get a collection for testCar',function() {
|
||||
it('should get a collection for testCar', function () {
|
||||
|
||||
})
|
||||
})
|
||||
@ -107,3 +107,24 @@ describe('mongodb', function () {
|
||||
mongoChildProcess.kill('SIGTERM')
|
||||
})
|
||||
})
|
||||
|
||||
describe('smartdata with nedb', function () {
|
||||
let testDb: smartdata.Db
|
||||
let testCollection: smartdata.DbCollection<ITestObject1>
|
||||
it('should create a DB with nedb', function () {
|
||||
testDb = new smartdata.Db('any', 'nedb')
|
||||
testDb.connect()
|
||||
testCollection = new smartdata.DbCollection<ITestObject1>('anyName', testDb)
|
||||
})
|
||||
|
||||
it('should insert a doc', function(done){
|
||||
testCollection.insertOne({ value1: 'hi' }).then(() => {done()})
|
||||
})
|
||||
|
||||
it('should find the inserted document', function(done){
|
||||
testCollection.find({ value1: 'hi' }).then(x => {
|
||||
console.log(x)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user