You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/__snapshots__/index.test.ts.snap
+33-20Lines changed: 33 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,5 @@
1
1
// Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
3
-
exports[`import-rename-codemod Should fail when asked to create impossible two or more defaults from named imports: Should fail when asked to create impossible two or more defaults from named imports 1`] =`
4
-
5
-
import One from 'one'
6
-
7
-
↓ ↓ ↓ ↓ ↓ ↓
8
-
9
-
Error: [BABEL] unknown: It's impossible to make two or more named imports into two or more defaults in one import statement! You should only have one 'default' value in your specifiers mapping (While processing: "base$0")
10
-
11
-
`;
12
-
13
-
exports[`import-rename-codemod Should fail when provided with wrong config shape: Should fail when provided with wrong config shape 1`] =`
14
-
15
-
import One from 'one'
16
-
17
-
↓ ↓ ↓ ↓ ↓ ↓
18
-
19
-
Error: [BABEL] unknown: Wrong specifiers format provided! It should be non-empty object or array. (While processing: "base$0")
20
-
21
-
`;
22
-
23
3
exports[`import-rename-codemod Should move default import and named imports: Should move default import and named imports 1`] =`
24
4
25
5
import ADefault, {One, Two, Three} from 'one'
@@ -87,6 +67,39 @@ import ADefault from 'two';
87
67
import {One, Two, Three} from 'one';
88
68
89
69
70
+
`;
71
+
72
+
exports[`import-rename-codemod Should not create useless default import if 'from' library import is present but has no required named import: Should not create useless default import if 'from' library import is present but has no required named import 1`] =`
73
+
74
+
import SomeImport from 'one'
75
+
76
+
↓ ↓ ↓ ↓ ↓ ↓
77
+
78
+
import SomeImport from 'one';
79
+
80
+
81
+
`;
82
+
83
+
exports[`import-rename-codemod Should not produce useless import if no match when default and named specifiers: Should not produce useless import if no match when default and named specifiers 1`] =`
84
+
85
+
import {Three} from 'one'
86
+
87
+
↓ ↓ ↓ ↓ ↓ ↓
88
+
89
+
import {Three} from 'one';
90
+
91
+
92
+
`;
93
+
94
+
exports[`import-rename-codemod Should not produce useless import if no match: Should not produce useless import if no match 1`] =`
95
+
96
+
import One, {Two} from 'one'
97
+
98
+
↓ ↓ ↓ ↓ ↓ ↓
99
+
100
+
import One, {Two} from 'one';
101
+
102
+
90
103
`;
91
104
92
105
exports[`import-rename-codemod When named to default should change import: When named to default should change import 1`] =`
"It's impossible to make two or more named imports into two or more defaults in one import statement! You should only have one 'default' value in your specifiers mapping"
76
-
);
65
+
// if (
66
+
// options.specifiers?.length === 0 ||
67
+
// typeof options.specifiers !== "object"
68
+
// ) {
69
+
// throw new Error(
70
+
// "Wrong specifiers format provided! It should be non-empty object or array."
71
+
// );
72
+
// }
73
+
// if (
74
+
// typeof options.specifiers === "object" &&
75
+
// Object.values(options.specifiers).filter((it) => it === "default").length >
76
+
// 1
77
+
// ) {
78
+
// throw new Error(
79
+
// "It's impossible to make two or more named imports into two or more defaults in one import statement! You should only have one 'default' value in your specifiers mapping"
0 commit comments