Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tests): ensure 2023 exists #6910

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ blocks:
- '8.0'
- env_var: NODEJS_VERSION
values:
- '14'
- '16'
- 'node'

Expand Down Expand Up @@ -119,6 +118,5 @@ blocks:
- '8.0'
- env_var: NODEJS_VERSION
values:
- '14'
- '16'
- 'node'
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@
"jeremielodi"
],
"dependencies": {
"@ima-worldhealth/coral": "^2.12.0",
"@ima-worldhealth/coral": "^2.13.0",
"@ima-worldhealth/odk-central-api-cjs": "^2.4.0",
"@ima-worldhealth/tree": "^2.6.0",
"@types/angular": "^1.8.4",
"@uirouter/angularjs": "^1.0.29",
"accounting-js": "^1.1.1",
"adm-zip": "^0.5.9",
"adm-zip": "^0.5.10",
"angular": "^1.8.3",
"angular-animate": "^1.8.3",
"angular-dynamic-locale": "^0.1.38",
Expand All @@ -100,7 +100,7 @@
"angular-translate-loader-url": "^2.19.0",
"angular-ui-bootstrap": "^2.5.6",
"angular-ui-grid": "^4.11.1",
"body-parser": "^1.20.0",
"body-parser": "^1.20.1",
"bootstrap": "^3.3.0",
"chart.js": "^3.9.1",
"chartjs-plugin-datalabels": "^2.1.0",
Expand All @@ -112,19 +112,19 @@
"debug": "^4.3.4",
"delay": "^5.0.0",
"dotenv": "^16.0.2",
"excel4node": "^1.7.0",
"express": "^4.18.1",
"excel4node": "^1.8.0",
"express": "^4.18.2",
"express-handlebars": "^6.0.6",
"express-session": "^1.17.3",
"font-awesome": "^4.7.0",
"handlebars": "^4.7.7",
"helmet": "^6.0.0",
"inline-source": "^8.0.2",
"ioredis": "^5.2.3",
"ioredis": "^5.2.5",
"jaro-winkler": "^0.2.8",
"jquery": "^3.6.1",
"jsbarcode": "^3.11.5",
"json-2-csv": "^3.17.1",
"json-2-csv": "^3.18.0",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.21",
"moment": "^2.29.4",
Expand All @@ -151,18 +151,19 @@
},
"devDependencies": {
"@ima-worldhealth/rewire": "^4.1.0",
"@types/node": "^18.11.18",
"angular-mocks": "^1.8.3",
"chai": "^4.3.4",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"chai-datetime": "^1.8.0",
"chai-http": "^4.3.0",
"chai-spies": "^1.0.0",
"chai-spies-next": "^0.9.3",
"cssnano": "^5.1.13",
"del": "^6.1.1",
"eslint": "^8.24.0",
"eslint": "^8.32.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-import": "^2.27.5",
"gulp": "^4.0.0",
"gulp-concat": "^2.6.1",
"gulp-if": "^3.0.0",
Expand All @@ -183,15 +184,15 @@
"karma-mocha": "^2.0.1",
"karma-ng-html2js-preprocessor": "^1.0.0",
"merge-stream": "^2.0.0",
"mocha": "^10.0.0",
"mocha": "^10.2.0",
"postcss": "^8.4.16",
"protractor": "^7.0.0",
"protractor-console-plugin": "^0.1.1",
"qs": "^6.11.0",
"release-it": "^15.4.1",
"release-it": "^15.6.0",
"sinon": "^14.0.0",
"standard-version": "^9.5.0",
"typescript": "^4.8.3"
"typescript": "^4.9.4"
},
"homepage": "https://docs.bhi.ma",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion sh/integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ echo "[test] building the server..."

echo "[test] running tests using mocha"
# run the tests
./node_modules/.bin/mocha --recursive --bail --exit ./test/integration/
./node_modules/.bin/mocha --recursive --bail --exit --timeout 20000 ./test/integration/

echo "[/test]"
3 changes: 3 additions & 0 deletions test/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ CALL CreateFiscalYear(1, @fiscalYear2020, @superUser, 'Fiscal Year 2021', 12, DA
SET @fiscalYear2022 = 0;
CALL CreateFiscalYear(1, @fiscalYear2021, @superUser, 'Fiscal Year 2022', 12, DATE('2022-01-01'), DATE('2022-12-31'), 'Notes for 2022', @fiscalYear2022);

SET @fiscalYear2023 = 0;
CALL CreateFiscalYear(1, @fiscalYear2022, @superUser, 'Fiscal Year 2023', 12, DATE('2023-01-01'), DATE('2023-12-31'), 'Notes for 2023', @fiscalYear2023);

-- give test permission to all projects
INSERT INTO `project_permission` VALUES (1, 1, 1),(2, 1, 2),(3, 2, 1),(4, 4, 1);

Expand Down
6 changes: 5 additions & 1 deletion test/integration/cash.invoices.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ function PatientInvoicePayments() {
.catch(helpers.handler);
});

it('POST /cash should not create a cash payment if cash items are empty', () => {
it('POST /cash should not create a cash payment if cash items are empty', function () { // eslint-disable-line

// increase timeout
this.timeout(6000);

return agent.post('/cash')
.send({ payment : INVALID_INVOICE_PAYMENT })
.then((res) => {
Expand Down
10 changes: 5 additions & 5 deletions test/integration/fiscalYear.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const helpers = require('./helpers');

describe('(/fiscal) Fiscal Year', () => {
const newFiscalYear = {
label : 'A New Fiscal Year 2023',
start_date : new Date('2023-01-01 01:00'),
end_date : new Date('2023-12-31 01:00'),
label : 'A New Fiscal Year 2024',
start_date : new Date('2024-01-01 01:00'),
end_date : new Date('2024-12-31 01:00'),
number_of_months : 12,
note : 'Fiscal Year for Integration Test',
closing_account : 111, // 1311 - Résusltat net : Bénéfice *
Expand Down Expand Up @@ -47,7 +47,7 @@ describe('(/fiscal) Fiscal Year', () => {
it('GET /fiscal returns a list of fiscal_years', () => {
return agent.get('/fiscal')
.then(res => {
helpers.api.listed(res, 9);
helpers.api.listed(res, 10);
const firstYearPeriods = res.body[0].periods;
expect(firstYearPeriods).to.be.equal(undefined);
})
Expand All @@ -57,7 +57,7 @@ describe('(/fiscal) Fiscal Year', () => {
it('GET /fiscal returns a list of fiscal_years width their periods', () => {
return agent.get('/fiscal?includePeriods=1')
.then(res => {
helpers.api.listed(res, 9);
helpers.api.listed(res, 10);
const firstYearPeriods = res.body[0].periods;
expect(firstYearPeriods).to.not.be.empty;
})
Expand Down
5 changes: 0 additions & 5 deletions test/integration/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ before(() => {
return agent.post('/auth/login').send(user);
});

beforeEach(function anonymous(done) {
this.timeout(10000);
done();
});

// runs after all tests are completed
after((done) => {
console.log('Test suite completed.');
Expand Down
Loading