mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Updated test execution scripts in package.json to include parallel and fast test options. Converted several `beforeEach` hooks to `before` in test files for more efficient application setup. Added documentation for test optimizations. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 271f3cac-bab1-4e81-9982-f31b3b030aab Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: ac6eb857-be5a-454b-96cf-b9c4c57f058b Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7ea4278b-5c6c-4065-9cb8-f1013771318d/271f3cac-bab1-4e81-9982-f31b3b030aab/69H2O1r Replit-Helium-Checkpoint-Created: true
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
var _ = require('lodash');
|
|
var language = require('../lib/language')();
|
|
|
|
describe('Clean MONGO after tests', function ( ) {
|
|
this.timeout(10000);
|
|
var self = this;
|
|
|
|
var api = require('../lib/api/');
|
|
|
|
// Use before() instead of beforeEach() for app setup - boots once for all tests
|
|
before(function (done) {
|
|
process.env.API_SECRET = 'this is my long pass phrase';
|
|
self.env = require('../lib/server/env')();
|
|
self.env.settings.authDefaultRoles = 'readable';
|
|
self.env.settings.enable = ['careportal', 'api'];
|
|
this.wares = require('../lib/middleware/')(self.env);
|
|
self.app = require('express')();
|
|
self.app.enable('api');
|
|
require('../lib/server/bootevent')(self.env, language).boot(function booted(ctx) {
|
|
self.ctx = ctx;
|
|
self.ctx.ddata = require('../lib/data/ddata')();
|
|
self.app.use('/api', api(self.env, ctx));
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('wipe treatment data', function (done) {
|
|
self.ctx.treatments().deleteMany({ }, function ( ) {
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('wipe entries data', function (done) {
|
|
self.ctx.entries().deleteMany({ }, function ( ) {
|
|
done();
|
|
});
|
|
});
|
|
|
|
});
|