Skip to content

Commit f44ab0a

Browse files
🧪 [test] add tests for pickRandomEndpoint
Co-authored-by: sunnylqm <615282+sunnylqm@users.noreply.github.com>
1 parent 184b18d commit f44ab0a

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎react-native-update-cli‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 62c129a9f38ef3ac900189e887bbeb7ca731b2ee

‎src/endpoint.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ export async function executeEndpointFallback<T>({
122122
throw new Error('No endpoints configured');
123123
}
124124

125-
const firstEndpoint = pickRandomEndpoint(candidates, random)!;
125+
const firstEndpoint = pickRandomEndpoint(candidates, random);
126+
if (!firstEndpoint) {
127+
throw new Error('No endpoints configured');
128+
}
126129

127130
try {
128131
return {

0 commit comments

Comments
 (0)