Skip to content

Commit af90816

Browse files
committed
chore: restore test code
1 parent 5c0c1df commit af90816

File tree

6 files changed

+33
-39
lines changed

6 files changed

+33
-39
lines changed

example/Tests.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,14 @@ class Tests extends Component {
128128
});
129129
// global.fs = require("react-native-fs");
130130
// global.path = require("path-browserify");
131-
// global.environment = {
132-
// Default to the host machine when running on Android
133-
// realmBaseUrl: Platform.OS === "android" ? "http://10.0.2.2:9090" : undefined,
134-
// ...context,
135-
// reactNative: Platform.OS,
136-
// android: Platform.OS === "android",
137-
// ios: Platform.OS === "ios",
138-
// };
139-
(global as any).environment = JSON.parse(
140-
Buffer.from(context.c as string, 'hex').toString('utf-8'),
141-
);
131+
global.environment = {
132+
// Default to the host machine when running on Android
133+
// realmBaseUrl: Platform.OS === "android" ? "http://10.0.2.2:9090" : undefined,
134+
...context,
135+
// reactNative: Platform.OS,
136+
// android: Platform.OS === "android",
137+
// ios: Platform.OS === "ios",
138+
};
142139
// Make the tests reinitializable, to allow test running on changes to the "realm" package
143140
// Probing the existance of `getModules` as this only exists in debug mode
144141
// if ("getModules" in require) {

example/android/app/src/androidTest/java/com/exmpl/DetoxTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public class DetoxTest {
2020
@Test
2121
public void runDetoxTests() {
2222
DetoxConfig detoxConfig = new DetoxConfig();
23-
detoxConfig.idlePolicyConfig.masterTimeoutSec = 120;
24-
detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 90;
25-
detoxConfig.rnContextLoadTimeoutSec = (BuildConfig.DEBUG ? 240 : 120);
23+
detoxConfig.idlePolicyConfig.masterTimeoutSec = 90;
24+
detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 60;
25+
detoxConfig.rnContextLoadTimeoutSec = (BuildConfig.DEBUG ? 180 : 60);
2626

2727
Detox.runTests(mActivityRule, detoxConfig);
2828
}

example/docker/docker-compose.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
version: '3'
12
services:
23
bitcoind:
34
container_name: bitcoin
@@ -111,10 +112,12 @@ services:
111112
depends_on:
112113
- bitcoind
113114
expose:
114-
- '18081' # REST
115+
- '18080' # REST
116+
- '18081' # DOCPORT
115117
- '9736' # P2P
116118
- '11001' # RPC
117119
ports:
120+
- '18080:18080'
118121
- '18081:18081'
119122
- '9736:9736'
120123
- '11001:11001'
@@ -132,12 +135,11 @@ services:
132135
- '--dev-bitcoind-poll=2'
133136
- '--dev-fast-gossip'
134137
- '--grpc-port=11001'
135-
- '--log-file=-'
136138
- '--bitcoin-rpcport=18443'
137-
- '--clnrest-port=18081'
138-
- '--clnrest-protocol=http'
139-
- '--clnrest-host=0.0.0.0'
140-
- '--developer'
139+
- '--plugin=/opt/c-lightning-rest/plugin.js'
140+
- '--rest-port=18080'
141+
- '--rest-protocol=http'
142+
- '--rest-docport=18081'
141143

142144
eclair:
143145
container_name: eclair

example/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
"reinstall": "cd ../lib/ && yarn install && yarn build && cd ../example/ && yarn add ../lib && yarn rn-setup",
2121
"clean": "rm -rf node_modules ios/Pods ios/Podfile.lock ios/build && yarn install && cd ios && pod deintegrate && pod install && cd ../",
2222
"rn-setup": "node rn-setup.js",
23-
"test:mocha": "mocha-remote --context c=$(node ./tests/context.js)",
24-
"test:mocha:ios": "mocha-remote --context c=$(node ./tests/context.js) -- concurrently --kill-others-on-fail npm:m npm:runner-ios",
25-
"test:mocha:android": "mocha-remote --context c=$(node ./tests/context.js) -- concurrently --kill-others-on-fail npm:m npm:runner-android",
23+
"test:mocha": "mocha-remote --context lndmacaroon=$(xxd -ps -u -c 1000 docker/lnd/admin.macaroon) clmacaroon=$(xxd -ps -u -c 1000 docker/clightning/access.macaroon)",
24+
"test:mocha:ios": "mocha-remote --context lndmacaroon=$(xxd -ps -u -c 1000 docker/lnd/admin.macaroon) clmacaroon=$(xxd -ps -u -c 1000 docker/clightning/access.macaroon) -- concurrently --kill-others-on-fail npm:m npm:runner-ios",
25+
"test:mocha:android": "mocha-remote --context lndmacaroon=$(xxd -ps -u -c 1000 docker/lnd/admin.macaroon) clmacaroon=$(xxd -ps -u -c 1000 docker/clightning/access.macaroon) -- concurrently --kill-others-on-fail npm:m npm:runner-android",
2626
"m": "react-native start --reset-cache",
2727
"runner-ios": "react-native run-ios --simulator='iPhone 14' --no-packager",
2828
"runner-android": "react-native run-android --no-packager"
@@ -40,7 +40,7 @@
4040
"chai": "^4.3.7",
4141
"crypto-browserify": "^3.12.0",
4242
"events": "^3.3.0",
43-
"mocha-remote-client": "^1.13.2",
43+
"mocha-remote-client": "^1.6.1",
4444
"process": "^0.11.10",
4545
"query-string": "^8.1.0",
4646
"react": "18.2.0",
@@ -76,15 +76,15 @@
7676
"bitcoin-json-rpc": "^1.3.2",
7777
"chai-as-promised": "^7.1.1",
7878
"concurrently": "^8.2.0",
79-
"detox": "20.23.1",
79+
"detox": "20.20.2",
8080
"electrum-client": "github:BlueWallet/rn-electrum-client#47acb51149e97fab249c3f8a314f708dbee4fb6e",
8181
"eslint": "8.27.0",
8282
"eslint-config-prettier": "^8.5.0",
8383
"fast-fifo": "^1.3.0",
8484
"jest": "^29.3.1",
8585
"metro-react-native-babel-preset": "0.76.8",
8686
"mocha": "^10.2.0",
87-
"mocha-remote-cli": "^1.13.2",
87+
"mocha-remote-cli": "^1.6.1",
8888
"newline-decoder": "^1.0.0",
8989
"prettier": "2.7.1",
9090
"react-test-renderer": "18.2.0",
@@ -95,7 +95,7 @@
9595
"node": ">=16"
9696
},
9797
"resolutions": {
98-
"**/ws": "^8.17.1",
98+
"**/ws": "^7.5.10",
9999
"**/semver": "^6.3.1",
100100
"**/brace-expansion": "^1.1.12",
101101
"**/cipher-base": "^1.0.5",

example/shim.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,3 @@ if (typeof localStorage !== 'undefined') {
3434
// If using the crypto shim, uncomment the following line to ensure
3535
// crypto is loaded first, so it can populate global.crypto
3636
require('crypto');
37-
38-
// Setup chai-as-promised for mocha tests
39-
const chai = require('chai');
40-
const chaiAsPromised = require('chai-as-promised');
41-
chai.use(chaiAsPromised);

example/yarn.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,7 +1837,7 @@
18371837
bitcoinjs-lib "6.1.4"
18381838

18391839
"@synonymdev/react-native-ldk@../lib":
1840-
version "0.0.162"
1840+
version "0.0.160"
18411841
dependencies:
18421842
"@synonymdev/raw-transaction-decoder" "1.1.0"
18431843
bech32 "^2.0.0"
@@ -6585,7 +6585,7 @@ mkdirp@^0.5.1, mkdirp@~0.5.1:
65856585
dependencies:
65866586
minimist "^1.2.6"
65876587

6588-
mocha-remote-cli@^1.13.2:
6588+
mocha-remote-cli@^1.6.1:
65896589
version "1.13.2"
65906590
resolved "https://registry.yarnpkg.com/mocha-remote-cli/-/mocha-remote-cli-1.13.2.tgz#464a89081256f62a4720674caa5bc06cc84bc2ab"
65916591
integrity sha512-Jly/TCM1BAhk3isQ4VzvHEfR5raRacjA9dqfvijN9X3/Gx+bJxQN+96AS41HiEi10PShrg6hWO2KvR49BlO68Q==
@@ -6595,7 +6595,7 @@ mocha-remote-cli@^1.13.2:
65956595
mocha-remote-server "1.13.2"
65966596
yargs "^17.7.2"
65976597

6598-
mocha-remote-client@^1.13.2:
6598+
mocha-remote-client@^1.6.1:
65996599
version "1.13.2"
66006600
resolved "https://registry.yarnpkg.com/mocha-remote-client/-/mocha-remote-client-1.13.2.tgz#db5ea0d1263f5fa38df7e5f8c62f1caa3007ff7f"
66016601
integrity sha512-XDzWQrjA1/CmrNg0TipFOL4xK5xkjWjpwv8INKwA2pQ0QUckRWcnhEQZO78EFI5+pLu4fTAl79at6Z0Cks7orA==
@@ -8784,10 +8784,10 @@ write-file-atomic@^4.0.2:
87848784
imurmurhash "^0.1.4"
87858785
signal-exit "^3.0.7"
87868786

8787-
ws@^6.2.2, ws@^7, ws@^7.0.0, ws@^7.5.1, ws@^8.17.1:
8788-
version "8.18.3"
8789-
resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.3.tgz#b56b88abffde62791c639170400c93dcb0c95472"
8790-
integrity sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==
8787+
ws@^6.2.2, ws@^7, ws@^7.0.0, ws@^7.5.1, ws@^7.5.10, ws@^8.17.1:
8788+
version "7.5.10"
8789+
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9"
8790+
integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==
87918791

87928792
xtend@^4.0.0, xtend@~4.0.1:
87938793
version "4.0.2"

0 commit comments

Comments
 (0)