Skip to content

Commit

Permalink
Refactored code to work with chai 5
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbrazzatti committed Jan 10, 2024
1 parent e6bffe5 commit 9d8200f
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 51 deletions.
4 changes: 2 additions & 2 deletions support/integration-testing/docker-compose.mocha.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ networks:
main:
services:
redboxportal:
image: qcifengineering/redbox-portal:feature-node20
image: qcifengineering/redbox-portal:develop
ports:
- "1500:1500"
volumes:
Expand Down Expand Up @@ -32,7 +32,7 @@ services:
- rbportal
entrypoint: /bin/bash -c "cd /opt/redbox-portal && node ./node_modules/mocha/bin/mocha --exit test/bootstrap.test.js test/unit/**/*.test.js"
mongodb:
image: mvertes/alpine-mongo:latest
image: mongo:latest
networks:
main:
aliases:
Expand Down
2 changes: 1 addition & 1 deletion support/integration-testing/docker-compose.newman.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ networks:
main:
services:
redboxportal:
image: qcifengineering/redbox-portal:feature-node20
image: qcifengineering/redbox-portal:develop
ports:
- "1500:1500"
volumes:
Expand Down
73 changes: 38 additions & 35 deletions test/bootstrap.test.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,57 @@
var sails = require('sails');
var _ = require('lodash');


global.chai = require('chai');
global.should = chai.should();
global.expect = chai.expect;
global.moment = require('moment');



before(function (done) {
// Increase the Mocha timeout so that Sails has enough time to lift.
this.timeout(120000);
sails.lift({
log: {
level: 'verbose'
},
hooks: {
grunt: false
},
models: {
datastore: 'mongodb',
migrate: 'drop'
},
security: {
csrf: false
},
datacite: {
import('chai').then(chai => {
global.chai = chai;
global.should = chai.should();
global.expect = chai.expect;

// Increase the Mocha timeout so that Sails has enough time to lift.
this.timeout(120000);
sails.lift({
log: {
level: 'verbose'
},
hooks: {
grunt: false
},
models: {
datastore: 'mongodb',
migrate: 'drop'
},
security: {
csrf: false
},
datacite: {
username: process.env.datacite_username,
password: process.env.datacite_password,
doiPrefix: process.env.datacite_doiPrefix
},
auth: {
default: {
local: {
default: {
token: 'jA8mF8CBpwHGkJqlgg6dT3hEDoZTQIif5t1V9ElIcN8='
}
}
}
}
},
auth: {
default: {
local: {
default: {
token: 'jA8mF8CBpwHGkJqlgg6dT3hEDoZTQIif5t1V9ElIcN8='
}
}
}
}
}, function (err, server) {
if (err) return done(err);
done(err, sails);
if (err) return done(err);
done(err, sails);
});
});


});

after(function (done) {
// here you can clear fixtures, etc.
if (sails && _.isFunction(sails.lower)) {
sails.lower(done);
sails.lower(done);
}
});
1 change: 0 additions & 1 deletion test/unit/services/AgendaService.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { expect } = require("chai");

describe('The Agenda Queue Service', function () {
before(function (done) {
Expand Down
4 changes: 0 additions & 4 deletions test/unit/services/DOIService.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
const {
expect
} = require("chai");

describe('The DOI Service', function () {
before(function (done) {
done();
Expand Down
2 changes: 1 addition & 1 deletion test/unit/services/FormsService.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { expect } = require("chai");


describe('The FormsService', function () {
before(function (done) {
Expand Down
4 changes: 1 addition & 3 deletions test/unit/services/ReportsService.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
expect
} = require("chai");


describe('The Reporting Service', function () {
before(function (done) {
Expand Down
4 changes: 0 additions & 4 deletions test/unit/services/SolrSearchService.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
const {
expect
} = require("chai");

describe('The Solr Indexing Service', function () {
before(function (done) {
done()
Expand Down

0 comments on commit 9d8200f

Please sign in to comment.