Skip to content

Commit

Permalink
test showing failure of recursive expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
motdotla committed Feb 15, 2024
1 parent 1e19f1e commit 4738a9e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,3 +509,20 @@ t.test('does not expand dollar sign that are not variables', ct => {

ct.end()
})

t.test('expands recursively', ct => {
const dotenv = {
parsed: {
BACKEND_API_HEALTH_CHECK_URL: '${MOCK_SERVER_HOST}/ci-health-check',
MOCK_SERVER_HOST: 'http://localhost:${MOCK_SERVER_PORT}',
MOCK_SERVER_PORT: '8090'
}
}
const parsed = dotenvExpand.expand(dotenv).parsed

ct.equal(parsed.MOCK_SERVER_PORT, '8090')
ct.equal(parsed.MOCK_SERVER_HOST, 'http://localhost:8090')
ct.equal(parsed.BACKEND_API_HEALTH_CHECK_URL, 'http://localhost:8090/ci-health-check')

ct.end()
})

0 comments on commit 4738a9e

Please sign in to comment.