diff options
author | Riyadh Al Nur <riyadhalnur@verticalaxisbd.com> | 2019-08-20 10:43:57 +0800 |
---|---|---|
committer | Riyadh Al Nur <riyadhalnur@verticalaxisbd.com> | 2019-08-20 10:43:57 +0800 |
commit | 2a0b04e29f1e1c23f74d8cea5c7bc3c396d18f59 (patch) | |
tree | 67c4daba84f8e808a1ac8f21f8d178171561332c | |
parent | 7882cf7967417d5fbaf7cb63a12d19471ddb27c4 (diff) |
BUG: Explicitly declare project name to pass in to Conf
-rw-r--r-- | index.js | 8 | ||||
-rw-r--r-- | schema.js | 15 | ||||
-rw-r--r-- | tests/tests.js | 7 |
3 files changed, 27 insertions, 3 deletions
@@ -1,10 +1,14 @@ 'use strict'; const axios = require('axios'); -const Conf =require('conf'); +const Conf = require('conf'); const API_URL = 'https://micro-weather.now.sh'; -const config = new Conf(); +const schema = require('./schema'); +const config = new Conf({ + projectName: 'weather-cli', + schema +}); const _toFahrenheit = temp => Math.round((9 / 5) * temp + 32); diff --git a/schema.js b/schema.js new file mode 100644 index 0000000..798906d --- /dev/null +++ b/schema.js @@ -0,0 +1,15 @@ +'use strict'; + +const schema = { + city: { + type: 'string' + }, + country: { + type: 'string' + }, + scale: { + type: 'string' + } +}; + +module.exports = schema; diff --git a/tests/tests.js b/tests/tests.js index 41dcd59..941f492 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -4,7 +4,12 @@ const chai = require('chai'); const chaiAsPromised = require('chai-as-promised'); const Conf = require('conf'); -const config = new Conf(); + +const schema = require('../schema'); +const config = new Conf({ + projectName: 'weather-cli', + schema +}); const weather = require('../index.js'); chai.use(chaiAsPromised); |