[test] Add failing test for empty return in useMemo callback
Sathya Gunasekaran committed
Apr 17, 2023 at 21:11 UTC
0e34c39c58882adf2edfe9c8a78b19b09c45bbab
2 files changed
+29
compiler/forget/src/__tests__/fixtures/compiler/error.useMemo-return-empty.expect.md
new
+22
@@ -0,0 +1,22 @@
1
+
2
+## Input
3
+
4
+```javascript
5
+// @inlineUseMemo
6
+function component(a) {
7
+ let x = useMemo(() => {
8
+ mutate(a);
9
+ }, []);
10
+ return x;
11
+}
12
+
13
+```
14
+
15
+
16
+## Error
17
+
18
+```
19
+Expected value for identifier `9` to be initialized.
20
+```
21
+
22
+
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/compiler/error.useMemo-return-empty.js
new
+7
@@ -0,0 +1,7 @@
1
+// @inlineUseMemo
2
+function component(a) {
3
+ let x = useMemo(() => {
4
+ mutate(a);
5
+ }, []);
6
+ return x;
7
+}