Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/shell-api/src/bulk.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ describe('Bulk API', () => {
it('throws if innerBulk.execute rejects', async() => {
const expectedError = new Error();
innerStub.execute.rejects(expectedError);
const catchedError = await bulk.execute()
const caughtError = await bulk.execute()
.catch(e => e);
expect(catchedError).to.equal(expectedError);
expect(caughtError).to.equal(expectedError);
});
});
describe('getOperations', () => {
Expand Down
64 changes: 32 additions & 32 deletions packages/shell-api/src/collection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -981,9 +981,9 @@ describe('Collection', () => {
});

it('rejects with error', async() => {
let catched;
await collection.dropIndexes('index_1').catch(err => { catched = err; });
expect(catched.message).to.equal(error.message);
let caught;
await collection.dropIndexes('index_1').catch(err => { caught = err; });
expect(caught.message).to.equal(error.message);
});
});
});
Expand All @@ -1001,25 +1001,25 @@ describe('Collection', () => {
});

it('throws if index is "*"', async() => {
let catched;
await collection.dropIndex('*').catch(err => { catched = err; });
let caught;
await collection.dropIndex('*').catch(err => { caught = err; });

expect(catched).to.be.instanceOf(MongoshInvalidInputError);
expect(catched.message).to.contain(
expect(caught).to.be.instanceOf(MongoshInvalidInputError);
expect(caught.message).to.contain(
'To drop indexes in the collection using \'*\', use db.collection.dropIndexes().'
);
expect(catched.code).to.equal(CommonErrors.InvalidArgument);
expect(caught.code).to.equal(CommonErrors.InvalidArgument);
});

it('throws if index is an array', async() => {
let catched;
await collection.dropIndex(['index-1']).catch(err => { catched = err; });
let caught;
await collection.dropIndex(['index-1']).catch(err => { caught = err; });

expect(catched).to.be.instanceOf(MongoshInvalidInputError);
expect(catched.message).to.contain(
expect(caught).to.be.instanceOf(MongoshInvalidInputError);
expect(caught.message).to.contain(
'The index to drop must be either the index name or the index specification document.'
);
expect(catched.code).to.equal(CommonErrors.InvalidArgument);
expect(caught.code).to.equal(CommonErrors.InvalidArgument);
});
});
});
Expand All @@ -1037,15 +1037,15 @@ describe('Collection', () => {
});

it('throws an error if called with verbose', async() => {
let catched;
let caught;
await collection.totalIndexSize(true)
.catch(err => { catched = err; });
.catch(err => { caught = err; });

expect(catched).to.be.instanceOf(MongoshInvalidInputError);
expect(catched.message).to.contain(
expect(caught).to.be.instanceOf(MongoshInvalidInputError);
expect(caught.message).to.contain(
'"totalIndexSize" takes no argument. Use db.collection.stats to get detailed information.'
);
expect(catched.code).to.equal(CommonErrors.InvalidArgument);
expect(caught.code).to.equal(CommonErrors.InvalidArgument);
});
});

Expand Down Expand Up @@ -1155,9 +1155,9 @@ describe('Collection', () => {
it('throws if serviceProvider.runCommandWithCheck rejects', async() => {
const expectedError = new Error();
serviceProvider.runCommandWithCheck.rejects(expectedError);
const catchedError = await collection.stats()
const caughtError = await collection.stats()
.catch(e => e);
expect(catchedError).to.equal(expectedError);
expect(caughtError).to.equal(expectedError);
});

it('throws is serviceProvider.runCommandWithCheck returns undefined', async() => {
Expand Down Expand Up @@ -1514,9 +1514,9 @@ describe('Collection', () => {
it('throws if serviceProvider.aggregate rejects', async() => {
const expectedError = new Error();
serviceProvider.aggregate.throws(expectedError);
const catchedError = await collection.latencyStats()
const caughtError = await collection.latencyStats()
.catch(e => e);
expect(catchedError).to.equal(expectedError);
expect(caughtError).to.equal(expectedError);
});
});

Expand All @@ -1542,9 +1542,9 @@ describe('Collection', () => {
it('throws if serviceProvider.initializeBulkOp rejects', async() => {
const expectedError = new Error();
serviceProvider.initializeBulkOp.throws(expectedError);
const catchedError = await collection.initializeUnorderedBulkOp()
const caughtError = await collection.initializeUnorderedBulkOp()
.catch(e => e);
expect(catchedError).to.equal(expectedError);
expect(caughtError).to.equal(expectedError);
});
});
describe('initializeOrderedBulkOp', () => {
Expand All @@ -1569,9 +1569,9 @@ describe('Collection', () => {
it('throws if serviceProvider rejects', async() => {
const expectedError = new Error();
serviceProvider.initializeBulkOp.throws(expectedError);
const catchedError = await collection.initializeOrderedBulkOp()
const caughtError = await collection.initializeOrderedBulkOp()
.catch(e => e);
expect(catchedError).to.equal(expectedError);
expect(caughtError).to.equal(expectedError);
});
});
describe('getPlanCache', () => {
Expand Down Expand Up @@ -1625,9 +1625,9 @@ describe('Collection', () => {
it('throws if serviceProvider.runCommand rejects', async() => {
const expectedError = new Error();
serviceProvider.runCommandWithCheck.rejects(expectedError);
const catchedError = await collection.validate()
const caughtError = await collection.validate()
.catch(e => e);
expect(catchedError).to.equal(expectedError);
expect(caughtError).to.equal(expectedError);
});
});
describe('mapReduce', () => {
Expand Down Expand Up @@ -1676,9 +1676,9 @@ describe('Collection', () => {
it('throws if serviceProvider.mapReduce rejects', async() => {
const expectedError = new Error();
serviceProvider.runCommandWithCheck.rejects(expectedError);
const catchedError = await collection.mapReduce(mapFn, reduceFn, { out: { inline: 1 } })
const caughtError = await collection.mapReduce(mapFn, reduceFn, { out: { inline: 1 } })
.catch(e => e);
expect(catchedError).to.equal(expectedError);
expect(caughtError).to.equal(expectedError);
});

it('throws if optiosn is an object and options.out is not defined', async() => {
Expand Down Expand Up @@ -1710,9 +1710,9 @@ describe('Collection', () => {
it('throws if serviceProvider.runCommand rejects', async() => {
const expectedError = new Error();
serviceProvider.runCommandWithCheck.rejects(expectedError);
const catchedError = await collection.getShardVersion()
const caughtError = await collection.getShardVersion()
.catch(e => e);
expect(catchedError).to.equal(expectedError);
expect(caughtError).to.equal(expectedError);
});
});
describe('getShardDistribution', () => {
Expand Down
Loading