-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix-test-mocks.sh
More file actions
executable file
·49 lines (42 loc) · 1.57 KB
/
fix-test-mocks.sh
File metadata and controls
executable file
·49 lines (42 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# List of test files that need the getTransactionReceipt mock
files=(
"src/tests/data-additional-methods.test.ts"
"src/tests/data-controller-edge-cases.test.ts"
"src/tests/data-relayer.test.ts"
"src/tests/data-simple-methods.test.ts"
"src/tests/data.test.ts"
"src/tests/dual-mode-permissions.test.ts"
"src/tests/dual-mode-trusted-servers.test.ts"
"src/tests/encryption-correct-implementation.test.ts"
"src/tests/helper-methods.test.ts"
"src/tests/new-permissions-methods.test.ts"
"src/tests/permissions-grantee.test.ts"
"src/tests/permissions-schema-validation.test.ts"
"src/tests/permissions-server-files.test.ts"
"src/tests/permissions-trust-servers.test.ts"
"src/tests/permissions.test.ts"
"src/tests/personal.test.ts"
"src/tests/protocol-additional-methods.test.ts"
"src/tests/protocol.test.ts"
"src/tests/trusted-server-queries.test.ts"
)
cd /workspace/packages/vana-sdk
for file in "${files[@]}"; do
echo "Processing $file..."
# Check if the file already has getTransactionReceipt
if grep -q "getTransactionReceipt:" "$file"; then
echo " Already has getTransactionReceipt, skipping..."
continue
fi
# Add getTransactionReceipt after waitForTransactionReceipt
sed -i '/waitForTransactionReceipt:.*vi\.fn/a\ getTransactionReceipt: vi.fn().mockResolvedValue({\
transactionHash: "0xTransactionHash",\
blockNumber: 12345n,\
gasUsed: 100000n,\
status: "success" as const,\
logs: [],\
}),' "$file"
echo " Added getTransactionReceipt mock"
done
echo "Done!"