Skip to content

Commit 819116c

Browse files
committed
feature: @putout/plugin-tape: convert-called-with-args: add spread
1 parent 9d3893e commit 819116c

File tree

9 files changed

+13
-3
lines changed

9 files changed

+13
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
t.calledWith(readbox, args, 'should call readbox');
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
t.calledWith(readbox, [...args], 'should call readbox');

packages/plugin-tape/lib/convert-called-with-args/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ module.exports.match = () => ({
1919

2020
module.exports.replace = () => ({
2121
't.calledWith(__a, __b)': 't.calledWith(__a, [__b])',
22+
't.calledWith(__a, [...__b], __c)': 't.calledWith(__a, __b, __c)',
2223
});

packages/plugin-tape/lib/convert-called-with-args/index.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ test('plugin-tape: convert-called-with-arguments: transform: args', (t) => {
1919
t.end();
2020
});
2121

22+
test('plugin-tape: convert-called-with-arguments: transform: spread', (t) => {
23+
t.transform('spread');
24+
t.end();
25+
});
26+
2227
test('plugin-tape: convert-called-with-arguments: no transform: identifier', (t) => {
2328
t.noTransform('identifier');
2429
t.end();

packages/plugin-tape/lib/convert-called-with-to-called-with-no-args/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
module.exports.report = () => '"calledWithNoArgs" should be used when arguments are absent';
3+
module.exports.report = () => `Use 'calledWithNoArgs()' when arguments are absent`;
44

55
module.exports.replace = () => ({
66
't.calledWith(__a)': 't.calledWithNoArgs(__a)',

packages/plugin-tape/lib/convert-called-with-to-called-with-no-args/index.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const test = createTest(__dirname, {
1010
});
1111

1212
test('plugin-tape: convert-called-with-to-called-with-no-args: report: no-args', (t) => {
13-
t.report('no-args', '"calledWithNoArgs" should be used when arguments are absent');
13+
t.report('no-args', `Use 'calledWithNoArgs()' when arguments are absent`);
1414
t.end();
1515
});
1616

packages/plugin-tape/lib/convert-ok-to-called-with/index.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test('plugin-tape: convert-ok-to-called-with: report: not-ok', (t) => {
1919
t.end();
2020
});
2121

22-
test('plugin-tape: called-with', (t) => {
22+
test('plugin-tape: convert-ok-to-called-with: called-with', (t) => {
2323
t.transform('called-with');
2424
t.end();
2525
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
t.calledWith(fn, [a]);
22
t.calledWith(fn, [a, b]);
33
t.calledWith(fn, a);
4+
t.calledWith(fn, a, 'x');
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
t.ok(fn.calledWith(a));
22
t.ok(fn.calledWith(a, b));
33
t.ok(fn.calledWith(...a));
4+
t.calledWith(fn, [...a], 'x')

0 commit comments

Comments
 (0)