Skip to content

Commit d18be9b

Browse files
committed
fix: correct CLI test port mismatch causing 5 CI failures
CLI hardcoded port 8080 for test mode but test server listens on 8085. Also make before() hook wait for server to be ready before running tests.
1 parent b36a49c commit d18be9b

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

cli/index.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import ed25519 from '@trashman/ed25519-blake2b'
1111

1212
const is_test = process.env.NODE_ENV === 'test'
1313

14-
const base_url = is_test ? 'http://localhost:8080' : 'https://nano.community'
14+
const base_url =
15+
process.env.NC_CLI_API_URL ||
16+
(is_test ? 'http://localhost:8085' : 'https://nano.community')
1517

1618
function sign_nano_community_link_key({
1719
linked_public_key,

test/cli.test.mjs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,17 @@ describe('CLI', function () {
4141
const nano_account_address =
4242
'nano_3d78japo7ziqqcsptk47eonzwzwjyaydcywq5ebzowjpxgyehynnjc9pd5zj'
4343

44-
before(() => {
45-
process.env.NC_CLI_NANO_PRIVATE_KEY = nano_private_key
46-
47-
server.listen(port, () => console.log(`API listening on port ${port}`))
48-
})
44+
before(
45+
() =>
46+
new Promise((resolve) => {
47+
process.env.NC_CLI_NANO_PRIVATE_KEY = nano_private_key
48+
49+
server.listen(port, () => {
50+
console.log(`API listening on port ${port}`)
51+
resolve()
52+
})
53+
})
54+
)
4955

5056
after(() => {
5157
server.close()

0 commit comments

Comments
 (0)