Skip to content

Commit

Permalink
chore: Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
marcbachmann committed Jan 30, 2019
1 parent 5888881 commit 025dfef
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const assert = require('assert')
const pointer = require('jsonpointer')
const _ = require('lodash')


module.exports = class Conf {

constructor (obj = {}) {
Expand Down Expand Up @@ -73,4 +72,4 @@ function getEnvVariables () {

function strToPointer (str) {
return `/${str.replace(/:/g, '/')}`
}
}
4 changes: 2 additions & 2 deletions test/fixtures/environments/with_invalid_code.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
foo : foobar()
}
foo: foobar() // eslint-disable-line no-undef
}
2 changes: 1 addition & 1 deletion test/fixtures/environments/with_invalid_secret.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
environments_with_invalid_secrets: true
}
}
5 changes: 2 additions & 3 deletions test/fixtures/secrets/with_invalid_secret.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module.exports = {
// undefined function
invalidSecret: foobar()
}
invalidSecret: foobar() // eslint-disable-line no-undef
}
26 changes: 14 additions & 12 deletions test/unit/conf_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ describe('The Conf', () => {
})

it('throws MODULE_NOT_FOUND errors if required', () => {
const loadWithInvalidRequire = () => Conf.loadEnvironment(pathToFixtures, 'with_invalid_require')
const loadWithInvalidRequire = () =>
Conf.loadEnvironment(pathToFixtures, 'with_invalid_require')
return expect(loadWithInvalidRequire).to.throw(/Cannot find module/)
})

Expand All @@ -47,7 +48,8 @@ describe('The Conf', () => {
})

it('throws errors other than MODULE_NOT_FOUND even if not required', () => {
const loadWithInvalidRequire = () => Conf.loadEnvironment(pathToFixtures, 'with_invalid_secret')
const loadWithInvalidRequire = () =>
Conf.loadEnvironment(pathToFixtures, 'with_invalid_secret')
return expect(loadWithInvalidRequire).to.throw('foobar is not defined')
})

Expand All @@ -59,11 +61,9 @@ describe('The Conf', () => {
})

it('are nested with the separator __', () => {
let config

process.env.server__host = 'localhost'

config = Conf.loadEnvironment(pathToFixtures, 'test')
const config = Conf.loadEnvironment(pathToFixtures, 'test')
return expect(config.get('server:host')).to.eql('localhost')
})

Expand All @@ -86,8 +86,10 @@ describe('The Conf', () => {
it('loads secrets/test', () => expect(config.get('secrets_test')).to.be.true)

it('does not include other environments', () => {
const getStagingEnvironments = () => config.get('environments_staging')
return expect(getStagingEnvironments).to["throw"]('Failed to get the required configuration for the key')
const getStagingEnvironments = () =>
config.get('environments_staging')
expect(getStagingEnvironments)
.to.throw('Failed to get the required configuration for the key')
})

})
Expand All @@ -103,14 +105,14 @@ describe('The Conf', () => {
return expect(config.get('overwritten')).to.be.true
})

it('adds new', function() {
it('adds new', function () {
const config = new Conf()

config.merge({added: true})
return expect(config.get('added')).to.be.true
})

it('merges existing', function() {
it('merges existing', function () {
const config = new Conf()

config.merge({
Expand Down Expand Up @@ -138,7 +140,7 @@ describe('The Conf', () => {

})

it('does not touch existing', function() {
it('does not touch existing', function () {
const config = new Conf({existing: true})

config.merge({added: true})
Expand Down Expand Up @@ -181,7 +183,7 @@ describe('The Conf', () => {
})

it('throws an error on null values?', () => {
const config = new Conf({ test: null })
const config = new Conf({test: null})
const getTest = () => config.get('test')

expect(getTest).to.throw
Expand Down Expand Up @@ -213,7 +215,7 @@ describe('The Conf', () => {
describe('toString:', () => {

it('creates a json representation of the config', () => {
const presets = {test : true}
const presets = {test: true}
const config = new Conf(presets)

expect(config.toString()).to.equal('{"test":true}')
Expand Down

0 comments on commit 025dfef

Please sign in to comment.