fix(core): update
This commit is contained in:
parent
e433b9e212
commit
38c1fcd53a
18
test/test.ts
18
test/test.ts
@ -73,8 +73,11 @@ tap.test('should save the car to the db', async () => {
|
|||||||
const myCar = new Car('red', 'Volvo');
|
const myCar = new Car('red', 'Volvo');
|
||||||
await myCar.save();
|
await myCar.save();
|
||||||
|
|
||||||
const myCar2 = new Car('red', 'Renault');
|
const myCar2 = new Car('red', 'Volvo');
|
||||||
await myCar2.save();
|
await myCar2.save();
|
||||||
|
|
||||||
|
const myCar3 = new Car('red', 'Renault');
|
||||||
|
await myCar3.save();
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('expect to get instance of Car', async () => {
|
tap.test('expect to get instance of Car', async () => {
|
||||||
@ -93,9 +96,18 @@ tap.test('expect to get instance of Car and update it', async () => {
|
|||||||
await myCar.save();
|
await myCar.save();
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should be able to update an instance of car', async () => {});
|
tap.test('should be able to delete an instance of car', async () => {
|
||||||
|
const myCar = await Car.getInstance<Car>({
|
||||||
|
brand: 'Volvo'
|
||||||
|
});
|
||||||
|
expect(myCar.color).to.equal('blue');
|
||||||
|
await myCar.delete();
|
||||||
|
|
||||||
tap.test('should be able to delete an instance of car', async () => {});
|
const myCar2 = await Car.getInstance<Car>({
|
||||||
|
brand: 'Volvo'
|
||||||
|
});
|
||||||
|
expect(myCar2.color).to.equal('red');
|
||||||
|
});
|
||||||
|
|
||||||
// =======================================
|
// =======================================
|
||||||
// close the database connection
|
// close the database connection
|
||||||
|
@ -143,7 +143,10 @@ export class SmartDataDbDoc<T> {
|
|||||||
/**
|
/**
|
||||||
* deletes a document from the database
|
* deletes a document from the database
|
||||||
*/
|
*/
|
||||||
public async delete() {}
|
public async delete() {
|
||||||
|
const self: any = this;
|
||||||
|
await this.collection.delete(self);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* also store any referenced objects to DB
|
* also store any referenced objects to DB
|
||||||
|
Loading…
Reference in New Issue
Block a user