Skip to content

Commit 9d89c29

Browse files
chore(deps): lock file maintenance (#843)
1 parent 03bdccb commit 9d89c29

File tree

7 files changed

+91
-94
lines changed

7 files changed

+91
-94
lines changed

src/rules/__tests__/valid-expect-in-promise.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ ruleTester.run('valid-expect-in-promise', rule, {
6767
});
6868
});
6969
`,
70+
dedent`
71+
it('it1', function () {
72+
Promise.resolve().then(/*fulfillment*/ function () {
73+
}, undefined, /*rejection*/ function () {
74+
expect(someThing).toEqual(true)
75+
})
76+
});
77+
`,
7078
dedent`
7179
it('it1', function () {
7280
return Promise.resolve().then(function () {

src/rules/no-mocks-import.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ const mocksDirName = '__mocks__';
77
const isMockPath = (path: string) =>
88
path.split(posix.sep).includes(mocksDirName);
99

10-
const isMockImportLiteral = (expression: TSESTree.Expression): boolean =>
10+
const isMockImportLiteral = (
11+
expression: TSESTree.CallExpressionArgument,
12+
): boolean =>
1113
isStringNode(expression) && isMockPath(getStringValue(expression));
1214

1315
export default createRule({

src/rules/no-test-return-statement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
isTestCaseCall,
1010
} from './utils';
1111

12-
const getBody = (args: TSESTree.Expression[]) => {
12+
const getBody = (args: TSESTree.CallExpressionArgument[]) => {
1313
const [, secondArg] = args;
1414

1515
if (

src/rules/prefer-todo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
isTestCaseCall,
1515
} from './utils';
1616

17-
function isEmptyFunction(node: TSESTree.Expression) {
17+
function isEmptyFunction(node: TSESTree.CallExpressionArgument) {
1818
if (!isFunction(node)) {
1919
return false;
2020
}

src/rules/valid-describe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
import { createRule, getNodeName, isDescribeCall, isFunction } from './utils';
66

77
const paramsLocation = (
8-
params: TSESTree.Expression[] | TSESTree.Parameter[],
8+
params: TSESTree.CallExpressionArgument[] | TSESTree.Parameter[],
99
) => {
1010
const [first] = params;
1111
const last = params[params.length - 1];

src/rules/valid-expect-in-promise.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,8 @@ const isParentThenOrPromiseReturned = (
120120
node.type === AST_NODE_TYPES.ReturnStatement ||
121121
isPromiseReturnedLater(node, testFunctionBody);
122122

123-
type PromiseCallbacks = [
124-
TSESTree.Expression | undefined,
125-
TSESTree.Expression | undefined,
126-
];
127-
128123
const verifyExpectWithReturn = (
129-
promiseCallbacks: PromiseCallbacks,
124+
promiseCallbacks: Array<TSESTree.CallExpressionArgument | undefined>,
130125
node: CalledKnownMemberExpression<'then' | 'catch'>,
131126
context: RuleContext,
132127
testFunctionBody: TSESTree.Statement[],
@@ -187,14 +182,13 @@ export default createRule<unknown[], MessageIds>({
187182
}
188183

189184
const testFunctionBody = body.body;
190-
const [fulfillmentCallback, rejectionCallback] = node.arguments;
191185

192186
// then block can have two args, fulfillment & rejection
193187
// then block can have one args, fulfillment
194188
// catch block can have one args, rejection
195189
// ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
196190
verifyExpectWithReturn(
197-
[fulfillmentCallback, rejectionCallback],
191+
node.arguments.slice(0, 2),
198192
node.callee,
199193
context,
200194
testFunctionBody,

0 commit comments

Comments
 (0)