Skip to content

Commit

Permalink
Replace test config with .env config.
Browse files Browse the repository at this point in the history
Less risk of publishing api details.
  • Loading branch information
chrisspiegl committed Mar 22, 2022
1 parent 54713ab commit c21cdaf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PUSHNOTICE_CHAT_ID=
PUSHNOTICE_CHAT_SECRET=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.env
*.sublime-project
*.sublime-workspace
node_modules
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
},
"devDependencies": {
"ava": "^4.1.0",
"dotenv": "^16.0.0",
"npm-check-updates": "^12.5.4",
"xo": "^0.48.0"
}
Expand Down
9 changes: 5 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import process from 'node:process'
import 'dotenv/config.js'// eslint-disable-line import/no-unassigned-import
import test from 'ava'
import pnotice from './index.js'

// TODO: find a way to load config.chat from file?
const config = {
chat: {
id: '',
secret: '',
id: process.env.PUSHNOTICE_CHAT_ID,
secret: process.env.PUSHNOTICE_CHAT_SECRET,
},
}

if (config.chat.id !== '') {
if (config.chat.id) {
console.log('Test file currently being run:', test.meta.file)

test('handle options.disabled = true', async (t) => {
Expand Down

0 comments on commit c21cdaf

Please sign in to comment.