Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Sep 13, 2024
1 parent dca8640 commit aa96ea0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
12 changes: 6 additions & 6 deletions test/unit/explain.test.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import { expect } from 'chai';
import { it, test } from 'mocha';
import { it } from 'mocha';

import { Explain, ExplainVerbosity } from '../mongodb';

describe('class Explain {}', function () {
describe('static .fromOptions()', function () {
test('when no options are provided, it returns undefined', function () {
it('when no options are provided, it returns undefined', function () {
expect(Explain.fromOptions()).to.be.undefined;
});

test('explain=true constructs an allPlansExecution explain', function () {
it('explain=true constructs an allPlansExecution explain', function () {
const explain = Explain.fromOptions({ explain: true });
expect(explain).to.have.property('verbosity', ExplainVerbosity.allPlansExecution);
expect(explain).to.have.property('maxTimeMS').to.be.undefined;
});

test('explain=false constructs an allPlansExecution explain', function () {
it('explain=false constructs an allPlansExecution explain', function () {
const explain = Explain.fromOptions({ explain: false });
expect(explain).to.have.property('verbosity', ExplainVerbosity.queryPlanner);
expect(explain).to.have.property('maxTimeMS').to.be.undefined;
});

test('explain=<type string> constructs an explain with verbosity set to the string', function () {
it('explain=<type string> constructs an explain with verbosity set to the string', function () {
const explain = Explain.fromOptions({ explain: 'some random string' });
expect(explain).to.have.property('verbosity', 'some random string');
expect(explain).to.have.property('maxTimeMS').to.be.undefined;
Expand All @@ -38,7 +38,7 @@ describe('class Explain {}', function () {
expect(explain).to.have.property('maxTimeMS').to.be.undefined;
});

test('when a maxTimeMS is provided, it constructs an explain with the maxTImeMS value', function () {
it('when a maxTimeMS is provided, it constructs an explain with the maxTImeMS value', function () {
const explain = Explain.fromOptions({
explain: {
verbosity: 'some random string',
Expand Down
7 changes: 3 additions & 4 deletions test/unit/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { expect } from 'chai';
import { test } from 'mocha';

import {
BufferPool,
Expand Down Expand Up @@ -1008,14 +1007,14 @@ describe('driver utils', function () {
});

describe('decorateWithExplain()', function () {
test('when the command is a valid explain command, the command is returned unmodified', function () {
it('when the command is a valid explain command, the command is returned unmodified', function () {
const command = Object.freeze({ explain: { hello: 'world' } });
const result = decorateWithExplain(command, Explain.fromOptions({ explain: true }));

expect(result).to.deep.equal(command);
});

test('when the options have a maxTimeMS, it is attached to the explain command', function () {
it('when the options have a maxTimeMS, it is attached to the explain command', function () {
const command = { ping: 1 };
const result = decorateWithExplain(
command,
Expand All @@ -1030,7 +1029,7 @@ describe('driver utils', function () {
});
});

test('when the options have do not have a maxTimeMS, it is not attached to the explain command', function () {
it('when the options have do not have a maxTimeMS, it is not attached to the explain command', function () {
const command = { ping: 1 };
const result = decorateWithExplain(
command,
Expand Down

0 comments on commit aa96ea0

Please sign in to comment.