-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathReactiveSearchV3Test.js
More file actions
48 lines (46 loc) · 1.08 KB
/
ReactiveSearchV3Test.js
File metadata and controls
48 lines (46 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const appbase = require("..");
const { uuidv4 } = require("../__mocks__");
const config = require("../__mocks__/defaultConfig");
describe("#Search", function () {
let client;
beforeAll(() => {
client = appbase({
url: config.URL,
app: config.APPNAME,
credentials: config.CREDENTIALS,
});
});
test("should return results", async () => {
var tweet = {
user: "olivere",
message: "Welcome to Golang and Elasticsearch.",
};
await client.index({
id: uuidv4(),
body: tweet,
});
const res = await client.reactiveSearchv3([
{
id: "tweet_search",
dataField: ["user"],
size: 10,
value: "olivere",
},
]);
expect(res.tweet_search.hits.total.value).toBeGreaterThan(0);
});
test("Elastic error", async () => {
try {
const res = await client.reactiveSearchv3([
{
id: "tweet_search",
dataField: ["user"],
type: "term",
size: 10,
},
]);
} catch (e) {
expect(e.tweet_search.status).toEqual(400);
}
});
});