Skip to content

Commit

Permalink
fix: delete order (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
BillDorn authored and redonkulus committed Jan 21, 2020
1 parent 31a8377 commit 652520b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ Config.prototype = {

contents = this._parseConfigContents(fullPath, contents);

// register so that _readConfigContents() will use
self._configContents[fullPath] = contents;

// deregister old config (if any)
self.deleteConfig(bundleName, configName, fullPath);

// register so that _readConfigContents() will use
self._configContents[fullPath] = contents;

if (!self._configPaths[bundleName]) {
self._configPaths[bundleName] = {};
}
Expand Down
15 changes: 15 additions & 0 deletions tests/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,21 @@ describe('config', function () {
expect(have.color).to.equal('red');
});
});
it('should work twice in a row', function () {
var config,
object = {color: 'red'};
config = new Config();
config.addConfigContents('foo', 'bar', 'x.js', object);
config.read('foo', 'bar', {}, function(err, have) {
expect(err).to.equal(null);
expect(have.color).to.equal('red');
});
config.addConfigContents('foo', 'bar', 'x.js', object);
config.read('foo', 'bar', {}, function(err, have) {
expect(err).to.equal(null);
expect(have.color).to.equal('red');
});
});
});


Expand Down

0 comments on commit 652520b

Please sign in to comment.