Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit ce7ce0b

Browse files
authored
improve normalizeConfig test (#241)
1 parent 21a8f5a commit ce7ce0b

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/agent/debuglet.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ module.exports = Debuglet;
9696
*/
9797
function Debuglet(debug, config) {
9898
/** @private {object} */
99-
this.config_ = this.normalizeConfig_(config);
99+
this.config_ = Debuglet.normalizeConfig_(config);
100100

101101
/** @private {Debug} */
102102
this.debug_ = debug;
@@ -139,7 +139,7 @@ function Debuglet(debug, config) {
139139

140140
util.inherits(Debuglet, EventEmitter);
141141

142-
Debuglet.prototype.normalizeConfig_ = function(config) {
142+
Debuglet.normalizeConfig_ = function(config) {
143143
var envConfig = {
144144
logLevel: process.env.GCLOUD_DEBUG_LOGLEVEL,
145145
serviceContext: {

test/test-debuglet.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,15 @@ describe('Debuglet', function() {
5959
afterEach(function() { nock.cleanAll(); });
6060

6161
it('should merge config correctly', function() {
62-
var debug = require('../src/debug.js')();
63-
6462
var testValue = 2 * defaultConfig.capture.maxExpandFrames;
6563
var config = {capture: {maxExpandFrames: testValue}};
66-
var debuglet = new Debuglet(debug, config);
6764

65+
var mergedConfig = Debuglet.normalizeConfig_(config);
66+
var compareConfig = Debuglet.normalizeConfig_();
6867
// The actual config should be exactly defaultConfig with only
6968
// maxExpandFrames adjusted.
70-
var compareConfig = extend(true, {}, defaultConfig);
7169
compareConfig.capture.maxExpandFrames = testValue;
72-
assert.deepEqual(debuglet.config_, compareConfig);
70+
assert.deepEqual(mergedConfig, compareConfig);
7371
});
7472

7573
it('should not start when projectId is not available', function(done) {

0 commit comments

Comments
 (0)