feat(core): now retrieves classes properly
This commit is contained in:
10
test/test.ts
10
test/test.ts
@ -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
|
||||
|
Reference in New Issue
Block a user