We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e085e39 commit 93d87a8Copy full SHA for 93d87a8
2 files changed
.changeset/quick-zoos-brake.md
@@ -0,0 +1,5 @@
1
+---
2
+'@graphprotocol/graph-cli': patch
3
4
+
5
+`graph init`: fix tests generation for events with [][] params #1878
packages/cli/src/scaffold/tests.ts
@@ -119,7 +119,13 @@ const isNativeType = (type: string) => {
119
return natives.some(rx => rx.test(type));
120
};
121
122
-const fetchArrayInnerType = (type: string) => type.match(/Array<(.*?)>/);
+// get inner type: Array<T> -> T, Array<Array<T>> -> T
123
+const fetchArrayInnerType = (type: string): RegExpMatchArray | null => {
124
+ const match = type.match(/Array<(.+)>/);
125
+ if (!match) return null;
126
127
+ return fetchArrayInnerType(match[1]) || match;
128
+};
129
130
// Generates the example test.ts file
131
const generateExampleTest = (
0 commit comments