Skip to content

Commit

Permalink
Return inserted object in addition to parsed object. They can be diff…
Browse files Browse the repository at this point in the history
…erent
  • Loading branch information
motdotla committed Mar 31, 2017
1 parent 6fe8147 commit a81895a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ describe('dotenv', function () {
beforeEach(function (done) {
readFileSyncStub = s.stub(fs, 'readFileSync').returns('test=val')
parseStub = s.stub(dotenv, 'parse').returns({test: 'val'})
delete process.env.test // clean up

done()
})

Expand Down Expand Up @@ -90,6 +92,16 @@ describe('dotenv', function () {
done()
})

it('returns inserted values and parsed values (which can be different if already preset)', function (done) {
process.env.test = 'test'

var env = dotenv.config()

env.parsed.should.eql({ test: 'val' })
env.inserted.should.eql({ test: 'test' })
done()
})

it('returns any errors thrown from reading file or parsing', function (done) {
readFileSyncStub.throws()

Expand Down

0 comments on commit a81895a

Please sign in to comment.