Skip to content

Commit

Permalink
Use .env file to override test server credentials.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaehring committed Oct 26, 2022
1 parent 171f828 commit 2d2b5d4
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules/**
dist/**
report.json
errors.json
.env
2 changes: 1 addition & 1 deletion core_schemata/update-script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const farmOS = require('../dist/cjs/farmOS').default;
const localServerConfig = require('../local-server-config.js');
const localServerConfig = require('../test/local-server-config.js');
const { writeSchema } = require('./fs-utils.js');

const $idURI = (entity, bundle) =>
Expand Down
81 changes: 59 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"chai-string": "^1.5.0",
"dotenv": "^16.0.3",
"eslint": "^8.7.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.25.4",
Expand Down
2 changes: 1 addition & 1 deletion test/client/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const client = require('../../dist/cjs/client').default;
const localServerConfig = require('../../local-server-config');
const localServerConfig = require('../local-server-config');

const {
host, clientId, username, password,
Expand Down
2 changes: 1 addition & 1 deletion test/client/user.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const chai = require('chai');
const localServerConfig = require('../../local-server-config');
const localServerConfig = require('../local-server-config');
const { reportError } = require('../report');
const { farm, session } = require('./client');

Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
const farmOS = require('../dist/cjs/farmOS').default;
const localServerConfig = require('../local-server-config');
const localServerConfig = require('./local-server-config');
const { reportError } = require('./report');

chai.use(chaiAsPromised);
Expand Down
6 changes: 4 additions & 2 deletions local-server-config.js → test/local-server-config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require('dotenv').config();

// These are the parameters required to connect to the local server used by
// tests and scripts in both the development and CI environments.
module.exports = {
host: 'http://localhost',
clientId: 'fieldkit',
username: 'admin',
password: 'admin',
username: process.env.TEST_USERNAME || 'admin',
password: process.env.TEST_USERNAME || 'admin',
};
2 changes: 1 addition & 1 deletion test/subrequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const chai = require('chai');
const { mergeRight } = require('ramda');
const farmOS = require('../dist/cjs/farmOS').default;
const { useSubrequests } = require('../dist/cjs/farmOS');
const localServerConfig = require('../local-server-config');
const localServerConfig = require('./local-server-config');
const { reportError } = require('./report');

const { expect } = chai;
Expand Down

0 comments on commit 2d2b5d4

Please sign in to comment.