import * as chai from 'chai'; const expect = chai.expect; import { ProfilePrimaryAddress } from './primary-address' import { MongoTxn } from '@birbal/mongo-utilities/dist/mongo-txn'; import { MongoTxnRegistry } from '@birbal/mongo-utilities/dist/mongo-txn-registry'; let testModel: ProfilePrimaryAddress; let txn: MongoTxn; let DB_NAME = "birbal_sample_db"; let SUPER_SECRET: string; let dbTxnId: string|undefined; describe('Birbal Resource test cases', function () { before(async function () { console.log("******BEGIN Tests*******"); process.env["BIRBAL_MONGO_HOST"] = "10.42.0.1"; process.env["BIRBAL_MONGO_PORT"] = "27017" process.env["BIRBAL_MONGO_POOL_SIZE"] = "4"; process.env["BIRBAL_MONGO_DATABASE"] = DB_NAME; process.env["BIRBAL_SYSTEM_SECRET"] = "asterix" process.env["BIRBAL_SYSTEM_PORT"] = "3000" process.env["BIRBAL_SYSTEM_HOST_TAG"] = "SampleSys" process.env["BIRBAL_SYSTEM_LOGTYPE"] = "5" process.env["BIRBAL_SYSTEM_LOGMODE"] = "console" txn = await MongoTxnRegistry.getSingleton().registerNewTxn(DB_NAME); await txn.beginTxn(); dbTxnId = txn.id; SUPER_SECRET = process.env["BIRBAL_SYSTEM_SECRET"]; }); after(async function () { await txn.commitTxn(); console.log("******END Tests*******"); }); it('Define Table', function (done) { this.timeout(5000); let model = new ProfilePrimaryAddress(DB_NAME); testModel = model; let promise = model.defineSchema() promise.then(() => { done(); }) .catch(err => { done(err); }); }); it('Sync Table', function (done) { this.timeout(5000); let promise = testModel.syncSchema(); promise.then((t) => { done(); }) .catch(err => { done(err); }); }); });