apostrophecms / apostrophecms/apostrophe
" redirect to the first prefixed locale that matches the requested hostname" test failures
- Dominant language
- JavaScript
- Stars
- 4.6k
- Forks
- 650
- Avg merge
- 19h 21m
- Merged PRs (30d)
- 23
Description
## To Reproduce
Step by step instructions to reproduce the behavior:
1. Clone this repo
2. `npm install`
3. Start local mongodb daemon
4. ` npx mocha test/i18n.js `
5. See error
## Expected behavior
All tests pass
## Describe the bug
Test output:
> 17 passing (7s)
> 2 failing
>
> 1) redirection to first locale
> should redirect to the first prefixed locale that matches the requested hostname:
> FetchError: request to http://ca.localhost:37957/ failed, reason: getaddrinfo ENOTFOUND ca.localhost
> at ClientRequest. (node_modules/node-fetch/lib/index.js:1501:11)
> at ClientRequest.emit (node:events:517:28)
> at Socket.socketErrorListener (node:_http_client:501:9)
> at Socket.emit (node:events:517:28)
> at emitErrorNT (node:internal/streams/destroy:151:8)
> at emitErrorCloseNT (node:internal/streams/destroy:116:3)
> at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
>
> 2) no redirection to first locale
> should not redirect to the first prefixed locale that matches the requested hostname when at least one locale has no prefix:
> FetchError: request to http://ca.localhost:36819/ failed, reason: getaddrinfo ENOTFOUND ca.localhost
> at ClientRequest. (node_modules/node-fetch/lib/index.js:1501:11)
> at ClientRequest.emit (node:events:517:28)
> at Socket.socketErrorListener (node:_http_client:501:9)
> at Socket.emit (node:events:517:28)
> at emitErrorNT (node:internal/streams/destroy:151:8)
> at emitErrorCloseNT (node:internal/streams/destroy:116:3)
> at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
>
## Details
**Version of Node.js:**
v18.20.6
**Server Operating System:**
Ubuntu 24.04.1 LTS on Windows wsl v2
**Additional Context:**
Mongo v8.0.4
Contributor guide
Research direction
Install dependencies and run `npx mocha test/i18n.js` with the local MongoDB daemon, then inspect the two failing redirection tests for the `ca.localhost` hostname resolution errors. Done means the two tests no longer fail and all tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- localization, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100