fix(core): update
This commit is contained in:
@ -45,12 +45,11 @@ tap.test('should create an easystore', async () => {
|
||||
});
|
||||
|
||||
tap.test('close', async () => {
|
||||
await testDb.mongoDb.dropDatabase();
|
||||
await testDb.close();
|
||||
if (smartmongoInstance) {
|
||||
await smartmongoInstance.stop();
|
||||
} else {
|
||||
await testDb.mongoDb.dropDatabase();
|
||||
}
|
||||
await testDb.close();
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -205,12 +205,11 @@ tap.test('should use a cursor', async () => {
|
||||
// close the database connection
|
||||
// =======================================
|
||||
tap.test('close', async () => {
|
||||
await testDb.mongoDb.dropDatabase();
|
||||
await testDb.close();
|
||||
if (smartmongoInstance) {
|
||||
await smartmongoInstance.stop();
|
||||
} else {
|
||||
await testDb.mongoDb.dropDatabase();
|
||||
}
|
||||
await testDb.close();
|
||||
});
|
||||
|
||||
tap.start({ throwOnError: true });
|
||||
|
@ -85,12 +85,11 @@ tap.test('should get a car', async () => {
|
||||
// close the database connection
|
||||
// =======================================
|
||||
tap.test('close', async () => {
|
||||
await testDb.mongoDb.dropDatabase();
|
||||
await testDb.close();
|
||||
if (smartmongoInstance) {
|
||||
await smartmongoInstance.stop();
|
||||
} else {
|
||||
await testDb.mongoDb.dropDatabase();
|
||||
}
|
||||
await testDb.close();
|
||||
});
|
||||
|
||||
tap.start({ throwOnError: true });
|
||||
|
@ -19,14 +19,26 @@ let testDb: smartdata.SmartdataDb;
|
||||
|
||||
const totalCars = 2000;
|
||||
|
||||
tap.test('should create a testinstance as database', async () => {
|
||||
tap.skip.test('should create a testinstance as database', async () => {
|
||||
smartmongoInstance = await smartmongo.SmartMongo.createAndStart();
|
||||
testDb = new smartdata.SmartdataDb(await smartmongoInstance.getMongoDescriptor());
|
||||
await testDb.init();
|
||||
});
|
||||
|
||||
tap.test('should connect to atlas', async (tools) => {
|
||||
const databaseName = `test-smartdata-${smartunique.shortId()}`;
|
||||
testDb = new smartdata.SmartdataDb({
|
||||
mongoDbUrl: testQenv.getEnvVarOnDemand('MONGO_URL'),
|
||||
mongoDbName: databaseName,
|
||||
});
|
||||
await testDb.init();
|
||||
});
|
||||
|
||||
@smartdata.Collection(() => testDb)
|
||||
class House extends smartdata.SmartDataDbDoc<House, House> {
|
||||
@smartdata.unI()
|
||||
public id: string = smartunique.shortId();
|
||||
|
||||
@smartdata.svDb()
|
||||
public data = {
|
||||
id: smartunique.shortId(),
|
||||
@ -34,16 +46,17 @@ class House extends smartdata.SmartDataDbDoc<House, House> {
|
||||
}
|
||||
}
|
||||
|
||||
tap.skip.test('should watch a collection', async (toolsArg) => {
|
||||
tap.test('should watch a collection', async (toolsArg) => {
|
||||
const done = toolsArg.defer();
|
||||
const watcher = await House.watch({});
|
||||
watcher.changeSubject.subscribe(houseArg => {
|
||||
watcher.changeSubject.subscribe(async houseArg => {
|
||||
console.log('hey there, we observed a house');
|
||||
watcher.close();
|
||||
await watcher.close();
|
||||
done.resolve();
|
||||
});
|
||||
const newHouse = new House();
|
||||
await newHouse.save();
|
||||
console.log('saved a house');
|
||||
await done.promise;
|
||||
})
|
||||
|
||||
@ -51,12 +64,11 @@ tap.skip.test('should watch a collection', async (toolsArg) => {
|
||||
// close the database connection
|
||||
// =======================================
|
||||
tap.test('close', async () => {
|
||||
await testDb.mongoDb.dropDatabase();
|
||||
await testDb.close();
|
||||
if (smartmongoInstance) {
|
||||
await smartmongoInstance.stop();
|
||||
} else {
|
||||
await testDb.mongoDb.dropDatabase();
|
||||
}
|
||||
await testDb.close();
|
||||
});
|
||||
|
||||
tap.start({ throwOnError: true });
|
Reference in New Issue
Block a user