Skip to content

Commit 546b75c

Browse files
authored
chore(shell-api): replace ‘catched’ with ‘caught’ (#1052)
I know it’s silly, but it catches me by surprise every time. :)
1 parent ad632f8 commit 546b75c

File tree

7 files changed

+324
-324
lines changed

7 files changed

+324
-324
lines changed

packages/shell-api/src/bulk.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ describe('Bulk API', () => {
167167
it('throws if innerBulk.execute rejects', async() => {
168168
const expectedError = new Error();
169169
innerStub.execute.rejects(expectedError);
170-
const catchedError = await bulk.execute()
170+
const caughtError = await bulk.execute()
171171
.catch(e => e);
172-
expect(catchedError).to.equal(expectedError);
172+
expect(caughtError).to.equal(expectedError);
173173
});
174174
});
175175
describe('getOperations', () => {

packages/shell-api/src/collection.spec.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,9 @@ describe('Collection', () => {
981981
});
982982

983983
it('rejects with error', async() => {
984-
let catched;
985-
await collection.dropIndexes('index_1').catch(err => { catched = err; });
986-
expect(catched.message).to.equal(error.message);
984+
let caught;
985+
await collection.dropIndexes('index_1').catch(err => { caught = err; });
986+
expect(caught.message).to.equal(error.message);
987987
});
988988
});
989989
});
@@ -1001,25 +1001,25 @@ describe('Collection', () => {
10011001
});
10021002

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

1007-
expect(catched).to.be.instanceOf(MongoshInvalidInputError);
1008-
expect(catched.message).to.contain(
1007+
expect(caught).to.be.instanceOf(MongoshInvalidInputError);
1008+
expect(caught.message).to.contain(
10091009
'To drop indexes in the collection using \'*\', use db.collection.dropIndexes().'
10101010
);
1011-
expect(catched.code).to.equal(CommonErrors.InvalidArgument);
1011+
expect(caught.code).to.equal(CommonErrors.InvalidArgument);
10121012
});
10131013

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

1018-
expect(catched).to.be.instanceOf(MongoshInvalidInputError);
1019-
expect(catched.message).to.contain(
1018+
expect(caught).to.be.instanceOf(MongoshInvalidInputError);
1019+
expect(caught.message).to.contain(
10201020
'The index to drop must be either the index name or the index specification document.'
10211021
);
1022-
expect(catched.code).to.equal(CommonErrors.InvalidArgument);
1022+
expect(caught.code).to.equal(CommonErrors.InvalidArgument);
10231023
});
10241024
});
10251025
});
@@ -1037,15 +1037,15 @@ describe('Collection', () => {
10371037
});
10381038

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

1044-
expect(catched).to.be.instanceOf(MongoshInvalidInputError);
1045-
expect(catched.message).to.contain(
1044+
expect(caught).to.be.instanceOf(MongoshInvalidInputError);
1045+
expect(caught.message).to.contain(
10461046
'"totalIndexSize" takes no argument. Use db.collection.stats to get detailed information.'
10471047
);
1048-
expect(catched.code).to.equal(CommonErrors.InvalidArgument);
1048+
expect(caught.code).to.equal(CommonErrors.InvalidArgument);
10491049
});
10501050
});
10511051

@@ -1155,9 +1155,9 @@ describe('Collection', () => {
11551155
it('throws if serviceProvider.runCommandWithCheck rejects', async() => {
11561156
const expectedError = new Error();
11571157
serviceProvider.runCommandWithCheck.rejects(expectedError);
1158-
const catchedError = await collection.stats()
1158+
const caughtError = await collection.stats()
11591159
.catch(e => e);
1160-
expect(catchedError).to.equal(expectedError);
1160+
expect(caughtError).to.equal(expectedError);
11611161
});
11621162

11631163
it('throws is serviceProvider.runCommandWithCheck returns undefined', async() => {
@@ -1514,9 +1514,9 @@ describe('Collection', () => {
15141514
it('throws if serviceProvider.aggregate rejects', async() => {
15151515
const expectedError = new Error();
15161516
serviceProvider.aggregate.throws(expectedError);
1517-
const catchedError = await collection.latencyStats()
1517+
const caughtError = await collection.latencyStats()
15181518
.catch(e => e);
1519-
expect(catchedError).to.equal(expectedError);
1519+
expect(caughtError).to.equal(expectedError);
15201520
});
15211521
});
15221522

@@ -1542,9 +1542,9 @@ describe('Collection', () => {
15421542
it('throws if serviceProvider.initializeBulkOp rejects', async() => {
15431543
const expectedError = new Error();
15441544
serviceProvider.initializeBulkOp.throws(expectedError);
1545-
const catchedError = await collection.initializeUnorderedBulkOp()
1545+
const caughtError = await collection.initializeUnorderedBulkOp()
15461546
.catch(e => e);
1547-
expect(catchedError).to.equal(expectedError);
1547+
expect(caughtError).to.equal(expectedError);
15481548
});
15491549
});
15501550
describe('initializeOrderedBulkOp', () => {
@@ -1569,9 +1569,9 @@ describe('Collection', () => {
15691569
it('throws if serviceProvider rejects', async() => {
15701570
const expectedError = new Error();
15711571
serviceProvider.initializeBulkOp.throws(expectedError);
1572-
const catchedError = await collection.initializeOrderedBulkOp()
1572+
const caughtError = await collection.initializeOrderedBulkOp()
15731573
.catch(e => e);
1574-
expect(catchedError).to.equal(expectedError);
1574+
expect(caughtError).to.equal(expectedError);
15751575
});
15761576
});
15771577
describe('getPlanCache', () => {
@@ -1625,9 +1625,9 @@ describe('Collection', () => {
16251625
it('throws if serviceProvider.runCommand rejects', async() => {
16261626
const expectedError = new Error();
16271627
serviceProvider.runCommandWithCheck.rejects(expectedError);
1628-
const catchedError = await collection.validate()
1628+
const caughtError = await collection.validate()
16291629
.catch(e => e);
1630-
expect(catchedError).to.equal(expectedError);
1630+
expect(caughtError).to.equal(expectedError);
16311631
});
16321632
});
16331633
describe('mapReduce', () => {
@@ -1676,9 +1676,9 @@ describe('Collection', () => {
16761676
it('throws if serviceProvider.mapReduce rejects', async() => {
16771677
const expectedError = new Error();
16781678
serviceProvider.runCommandWithCheck.rejects(expectedError);
1679-
const catchedError = await collection.mapReduce(mapFn, reduceFn, { out: { inline: 1 } })
1679+
const caughtError = await collection.mapReduce(mapFn, reduceFn, { out: { inline: 1 } })
16801680
.catch(e => e);
1681-
expect(catchedError).to.equal(expectedError);
1681+
expect(caughtError).to.equal(expectedError);
16821682
});
16831683

16841684
it('throws if optiosn is an object and options.out is not defined', async() => {
@@ -1710,9 +1710,9 @@ describe('Collection', () => {
17101710
it('throws if serviceProvider.runCommand rejects', async() => {
17111711
const expectedError = new Error();
17121712
serviceProvider.runCommandWithCheck.rejects(expectedError);
1713-
const catchedError = await collection.getShardVersion()
1713+
const caughtError = await collection.getShardVersion()
17141714
.catch(e => e);
1715-
expect(catchedError).to.equal(expectedError);
1715+
expect(caughtError).to.equal(expectedError);
17161716
});
17171717
});
17181718
describe('getShardDistribution', () => {

0 commit comments

Comments
 (0)