review the internal schema to allow to create schema without identifier; fix #513

This commit is contained in:
qdequele 2020-03-05 18:29:10 +01:00
parent 16a99aa95e
commit 86c3482cbd
No known key found for this signature in database
GPG key ID: B3F0A000EBF11745
11 changed files with 312 additions and 129 deletions

View file

@ -252,3 +252,73 @@ fn write_all_and_update() {
assert_json_eq!(expected, response, ordered: false);
}
#[test]
fn test_default_settings() {
let mut server = common::Server::with_uid("movies");
let body = json!({
"uid": "movies",
});
server.create_index(body);
// 1 - Get all settings and compare to the previous one
let body = json!({
"rankingRules": [
"typo",
"words",
"proximity",
"attribute",
"wordsPosition",
"exactness"
],
"distinctAttribute": null,
"searchableAttributes": [],
"displayedAttributes": [],
"stopWords": [],
"synonyms": {},
"acceptNewFields": true,
});
let (response, _status_code) = server.get_all_settings();
assert_json_eq!(body, response, ordered: false);
}
#[test]
fn test_default_settings_2() {
let mut server = common::Server::with_uid("movies");
let body = json!({
"uid": "movies",
"identifier": "id",
});
server.create_index(body);
// 1 - Get all settings and compare to the previous one
let body = json!({
"rankingRules": [
"typo",
"words",
"proximity",
"attribute",
"wordsPosition",
"exactness"
],
"distinctAttribute": null,
"searchableAttributes": [
"id"
],
"displayedAttributes": [
"id"
],
"stopWords": [],
"synonyms": {},
"acceptNewFields": true,
});
let (response, _status_code) = server.get_all_settings();
assert_json_eq!(body, response, ordered: false);
}