-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(git): fix conflict due to weird release
- Loading branch information
Showing
10 changed files
with
565 additions
and
833 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,4 @@ runs: | |
shell: bash | ||
|
||
- run: npm run test:unit | ||
shell: bash | ||
|
||
- run: npm run codecov | ||
shell: bash | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { Kuzzle, WebSocket } from "kuzzle-sdk"; | ||
|
||
const kuzzle = new Kuzzle(new WebSocket("localhost")); | ||
const index = "nyc-open-data"; | ||
const collection = "green-taxi"; | ||
const mappings = { | ||
dynamic: "false" as const, | ||
properties: { | ||
name: { | ||
type: "keyword", | ||
}, | ||
}, | ||
}; | ||
|
||
beforeAll(async () => { | ||
await kuzzle.connect(); | ||
if (await kuzzle.index.exists(index)) { | ||
await kuzzle.index.delete(index); | ||
} | ||
|
||
await kuzzle.index.create(index); | ||
await kuzzle.collection.create(index, collection, { | ||
mappings, | ||
}); | ||
}); | ||
|
||
afterAll(async () => { | ||
await kuzzle.index.delete(index); | ||
kuzzle.disconnect(); | ||
}); | ||
|
||
describe("collection:update", () => { | ||
it("should reindex the collection if asked to", async () => { | ||
await kuzzle.document.create( | ||
index, | ||
collection, | ||
{ age: 42, name: "Bob" }, | ||
"document-1", | ||
{ refresh: "wait_for" }, | ||
); | ||
|
||
let result = await kuzzle.document.search(index, collection, { | ||
query: { | ||
range: { | ||
age: { | ||
gte: 40, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
expect(result.hits.length).toEqual(0); | ||
|
||
await kuzzle.collection.update(index, collection, { | ||
mappings: { properties: { age: { type: "long" } } }, | ||
reindexCollection: true, | ||
}); | ||
|
||
// Wait for the reindexing to complete | ||
await new Promise((r) => setTimeout(r, 2000)); | ||
|
||
result = await kuzzle.document.search(index, collection, { | ||
query: { | ||
range: { | ||
age: { | ||
gte: 40, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
expect(result.hits.length).toEqual(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.