feat(core): now retrieves classes properly

This commit is contained in:
2018-01-14 17:32:04 +01:00
parent e2d12f8c9c
commit d2ca108ef8
21 changed files with 484 additions and 398 deletions

View File

@ -34,8 +34,9 @@ tap.test('should establish a connection to the rethink Db cluster', async () =>
// Collections
// ------
@smartdata.Collection(testDb)
@smartdata.Table(testDb)
class Car extends smartdata.DbDoc<Car> {
@smartdata.svDb() color: string
@smartdata.svDb() brand: string
constructor (colorArg: string, brandArg: string) {
@ -50,6 +51,13 @@ tap.test('should save the car to the db', async () => {
await myCar.save()
})
tap.test('expect to get instance of Car', async () => {
let myCar = await Car.getInstances<Car>({
brand: 'Volvo'
})
expect(myCar[0].color).to.equal('red')
})
// =======================================
// close the database connection