Skip to content

Commit 36c16dc

Browse files
unit test fixes
1 parent 1954501 commit 36c16dc

File tree

2 files changed

+5
-36
lines changed

2 files changed

+5
-36
lines changed

test/unit/cmap/command_monitoring_events.test.js

+4-35
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ const { expect } = require('chai');
66

77
describe('Command Monitoring Events - unit/cmap', function () {
88
const commands = [
9-
new Query('admin.$cmd', { a: { b: 10 }, $query: { b: 10 } }, {}),
9+
new Query('admin', { a: { b: 10 }, $query: { b: 10 } }, {}),
1010
new Query('hello', { a: { b: 10 }, $query: { b: 10 } }, {}),
11-
new Msg('admin.$cmd', { b: { c: 20 } }, {}),
11+
new Msg('admin', { b: { c: 20 } }, {}),
1212
new Msg('hello', { b: { c: 20 } }, {}),
1313
{ ns: 'admin.$cmd', query: { $query: { a: 16 } } },
1414
{ ns: 'hello there', f1: { h: { a: 52, b: { c: 10, d: [1, 2, 3, 5] } } } }
@@ -48,9 +48,8 @@ describe('Command Monitoring Events - unit/cmap', function () {
4848

4949
it('should wrap a basic query option', function () {
5050
const db = 'test1';
51-
const coll = 'testingQuery';
5251
const query = new Query(
53-
`${db}.${coll}`,
52+
`${db}`,
5453
{
5554
testCmd: 1,
5655
fizz: 'buzz',
@@ -69,9 +68,8 @@ describe('Command Monitoring Events - unit/cmap', function () {
6968

7069
it('should upconvert a Query wrapping a command into the corresponding command', function () {
7170
const db = 'admin';
72-
const coll = '$cmd';
7371
const query = new Query(
74-
`${db}.${coll}`,
72+
`${db}`,
7573
{
7674
$query: {
7775
testCmd: 1,
@@ -92,34 +90,5 @@ describe('Command Monitoring Events - unit/cmap', function () {
9290
expect(startEvent).to.have.property('connectionId').that.is.a('string');
9391
expect(startEvent).to.have.property('command').that.deep.equals(query.query.$query);
9492
});
95-
96-
it('should upconvert a Query wrapping a query into a find command', function () {
97-
const db = 'test5';
98-
const coll = 'testingFindCommand';
99-
const query = new Query(
100-
`${db}.${coll}`,
101-
{
102-
$query: {
103-
testCmd: 1,
104-
fizz: 'buzz',
105-
star: 'trek'
106-
}
107-
},
108-
{}
109-
);
110-
111-
const startEvent = new CommandStartedEvent(conn, query);
112-
113-
expect(startEvent).to.have.property('commandName', 'find');
114-
expect(startEvent).to.have.property('databaseName', db);
115-
expect(startEvent).to.have.property('requestId', query.requestId);
116-
expect(startEvent).to.have.property('connectionId').that.is.a('string');
117-
expect(startEvent).to.have.property('command').that.deep.equals({
118-
find: coll,
119-
filter: query.query.$query,
120-
batchSize: 0,
121-
skip: 0
122-
});
123-
});
12493
});
12594
});

test/unit/cmap/message_stream.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe('MessageStream', function () {
139139
const messageStream = new MessageStream();
140140
messageStream.pipe(writeableStream);
141141

142-
const command = new Msg('admin.$cmd', { [LEGACY_HELLO_COMMAND]: 1 }, { requestId: 3 });
142+
const command = new Msg('admin', { [LEGACY_HELLO_COMMAND]: 1 }, { requestId: 3 });
143143
messageStream.writeCommand(command, {
144144
started: 0,
145145
command: true,

0 commit comments

Comments
 (0)