diff --git a/package.json b/package.json index 165904d1c..e7f7277a1 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "Register *.is-a.dev domains for free", "scripts": { - "test": "jest", + "test": "ENV=test jest", "publish-records": "yarn test && node ./scripts/register-domains.js" }, "repository": { diff --git a/utils/constants.js b/utils/constants.js index 0c0e43bfe..89a9b627f 100644 --- a/utils/constants.js +++ b/utils/constants.js @@ -8,12 +8,14 @@ if (!CI) { const { NC_USER, NC_API_KEY, NC_DOMAIN, IP_ADDRESS } = process.env; +const IS_TEST = ENV === 'test'; + module.exports = { ENV, VALID_RECORD_TYPES: ['CNAME', 'A', 'ALIAS', 'URL'], NC_DOMAIN: NC_DOMAIN || 'booboo.xyz', - NC_USER, - NC_API_KEY, + NC_USER: IS_TEST ? 'testuser' : NC_USER, + NC_API_KEY: IS_TEST ? 'testkey' : NC_API_KEY, IP_ADDRESS, TTL: 5*60, };