Skip to content

Commit

Permalink
test(apm): make sure to uninstrument listener after each test
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Sep 9, 2017
1 parent 2c88926 commit 226c803
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/functional/apm_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1011,9 +1011,9 @@ describe('APM', function() {
expect(databaseName).to.equal(result.databaseName);

// Do we have a getMore command or killCursor command
if (commandName == 'getMore') {
if (commandName === 'getMore') {
expect(result.command.getMore.isZero()).to.be.false;
} else if (commandName == 'killCursors') {
} else if (commandName === 'killCursors') {
// eslint-disable-line
} else {
expect(command).to.eql(result.command);
Expand All @@ -1031,7 +1031,7 @@ describe('APM', function() {
// Validate the test
expect(commandName).to.equal(result.commandName);
// Do we have a getMore command
if (commandName.toLowerCase() == 'getmore' || commandName.toLowerCase() == 'find') {
if (commandName.toLowerCase() === 'getmore' || commandName.toLowerCase() === 'find') {
reply.cursor.id = result.reply.cursor.id;
expect(reply).to.eql(result.reply);
}
Expand Down Expand Up @@ -1136,15 +1136,15 @@ describe('APM', function() {
}
}

if (typeof args.ordered == 'boolean') {
if (typeof args.ordered === 'boolean') {
if (options == null) {
options = { ordered: args.ordered };
} else {
options.ordered = args.ordered;
}
}

if (typeof args.upsert == 'boolean') {
if (typeof args.upsert === 'boolean') {
if (options == null) {
options = { upsert: args.upsert };
} else {
Expand All @@ -1153,7 +1153,7 @@ describe('APM', function() {
}

// Find command is special needs to executed using toArray
if (operation.name == 'find') {
if (operation.name === 'find') {
var cursor = collection[commandName]();

// Set the options
Expand Down Expand Up @@ -1245,6 +1245,7 @@ describe('APM', function() {
executeOperation(client, listener, scenario, test, err => {
expect(err).to.not.exist;

listener.uninstrument();
client.close();
done();
});
Expand Down

0 comments on commit 226c803

Please sign in to comment.