Skip to content

Commit b4765c0

Browse files
committed
Update host validation tests
1 parent abc75fa commit b4765c0

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ services:
88
working_dir: /home/package
99
environment:
1010
- MEILISEARCH_HOST=http://meilisearch:7700
11-
- MEILISEARCH_PORT=7700
1211
depends_on:
1312
- meilisearch
1413
links:

tests/client_tests.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
config,
1414
MeiliSearch,
1515
BAD_HOST,
16+
HOST,
1617
} from './meilisearch-test-utils'
1718

1819
const indexNoPk = {
@@ -134,15 +135,17 @@ describe.each([
134135
})
135136

136137
test(`${permission} key: host without HTTP should not throw Invalid URL Error`, async () => {
137-
const client = new MeiliSearch({ host: 'meilisearch:7700' })
138-
const health = await client.isHealthy()
139-
expect(health).toBe(false)
138+
const strippedHost = HOST.replace('http://', '')
139+
expect(() => {
140+
new MeiliSearch({ host: strippedHost })
141+
}).not.toThrow('The provided host is not valid.')
140142
})
141143

142144
test(`${permission} key: host without HTTP and port should not throw Invalid URL Error`, async () => {
143-
const client = new MeiliSearch({ host: 'meilisearch' })
144-
const health = await client.isHealthy()
145-
expect(health).toBe(false)
145+
const strippedHost = HOST.replace('http://', '').replace(':7700', '')
146+
expect(() => {
147+
new MeiliSearch({ host: strippedHost })
148+
}).not.toThrow('The provided host is not valid.')
146149
})
147150

148151
test(`${permission} key: Empty string host should throw an error`, () => {

0 commit comments

Comments
 (0)