Skip to content

Commit a3da1ce

Browse files
committed
test: extend expect cases
1 parent 12a3763 commit a3da1ce

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

packages/e2e-tests/test/e2e.spec.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,11 +1512,13 @@ describe('e2e', function () {
15121512
expect(shell.assertNoErrors());
15131513
await eventually(async () => {
15141514
const log = await readLogfile();
1515-
expect(
1516-
log.filter((logEntry) =>
1517-
logEntry.msg.includes('This is a custom entry')
1518-
)
1519-
).to.have.lengthOf(1);
1515+
const customLogEntry = log.filter((logEntry) =>
1516+
logEntry.msg.includes('This is a custom entry')
1517+
);
1518+
expect(customLogEntry).to.have.lengthOf(1);
1519+
expect(customLogEntry[0].s).to.be.equal('I');
1520+
expect(customLogEntry[0].c).to.be.equal('MONGOSH-SCRIPTS');
1521+
expect(customLogEntry[0].ctx).to.be.equal('custom-log');
15201522
});
15211523
});
15221524

packages/logging/src/setup-logger-and-telemetry.spec.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,10 +868,15 @@ describe('setupLoggerAndTelemetry', function () {
868868

869869
bus.emit('mongosh:write-custom-log', {
870870
method: 'debug',
871-
message: 'Debug',
871+
message: 'Debug with level',
872872
level: 1,
873873
});
874874

875+
bus.emit('mongosh:write-custom-log', {
876+
method: 'debug',
877+
message: 'Debug without level',
878+
});
879+
875880
expect(logOutput[0].msg).to.equal('Connecting to server');
876881
expect(logOutput[0].attr.connectionUri).to.equal('mongodb://localhost/');
877882
expect(logOutput[0].attr.is_localhost).to.equal(true);
@@ -903,7 +908,12 @@ describe('setupLoggerAndTelemetry', function () {
903908
expect(logOutput[5].s).to.equal('D1');
904909
expect(logOutput[5].c).to.equal('MONGOSH-SCRIPTS');
905910
expect(logOutput[5].ctx).to.equal('custom-log');
906-
expect(logOutput[5].msg).to.equal('Debug');
911+
expect(logOutput[5].msg).to.equal('Debug with level');
912+
913+
expect(logOutput[6].s).to.equal('D1');
914+
expect(logOutput[6].c).to.equal('MONGOSH-SCRIPTS');
915+
expect(logOutput[6].ctx).to.equal('custom-log');
916+
expect(logOutput[6].msg).to.equal('Debug without level');
907917

908918
expect(analyticsOutput).to.deep.equal([
909919
[

0 commit comments

Comments
 (0)