Skip to content

Commit

Permalink
chore(clients): add more e2e (#2497)
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts committed Jan 9, 2024
1 parent 550e565 commit 4dc28da
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 9 deletions.
2 changes: 1 addition & 1 deletion scripts/cts/runCts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function runCtsOne(language: string): Promise<void> {
});
break;
case 'ruby':
await run(`bundle install && bundle exec rake test`, { cwd: 'tests/output/ruby' });
await run(`bundle install && bundle exec rake test --trace`, { cwd: 'tests/output/ruby' });
break;
case 'scala':
await run('sbt test', { cwd: 'tests/output/scala' });
Expand Down
15 changes: 13 additions & 2 deletions tests/CTS/requests/search/browse.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@
{
"testName": "browse with minimal parameters",
"parameters": {
"indexName": "indexName"
"indexName": "cts_e2e_browse"
},
"request": {
"path": "/1/indexes/indexName/browse",
"path": "/1/indexes/cts_e2e_browse/browse",
"method": "POST"
},
"response": {
"statusCode": 200,
"body": {
"page": 0,
"nbHits": 33191,
"nbPages": 34,
"hitsPerPage": 1000,
"query": "",
"params": ""
}
}
},
{
Expand Down
35 changes: 33 additions & 2 deletions tests/CTS/requests/search/getSettings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,42 @@
[
{
"parameters": {
"indexName": "theIndexName"
"indexName": "cts_e2e_settings"
},
"request": {
"path": "/1/indexes/theIndexName/settings",
"path": "/1/indexes/cts_e2e_settings/settings",
"method": "GET"
},
"response": {
"statusCode": 200,
"body": {
"minWordSizefor1Typo": 4,
"minWordSizefor2Typos": 8,
"hitsPerPage": 20,
"maxValuesPerFacet": 100,
"version": 1,
"paginationLimitedTo": 10,
"exactOnSingleWordQuery": "attribute",
"ranking": [
"typo",
"geo",
"words",
"filters",
"proximity",
"attribute",
"exact",
"custom"
],
"separatorsToIndex": "",
"removeWordsIfNoResults": "none",
"queryType": "prefixLast",
"highlightPreTag": "<em>",
"highlightPostTag": "</em>",
"alternativesAsExact": [
"ignorePlurals",
"singleWordSynonym"
]
}
}
}
]
7 changes: 5 additions & 2 deletions tests/CTS/requests/search/setSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@
{
"testName": "setSettings with minimal parameters",
"parameters": {
"indexName": "theIndexName",
"indexName": "cts_e2e_settings",
"indexSettings": {
"paginationLimitedTo": 10
},
"forwardToReplicas": true
},
"request": {
"path": "/1/indexes/theIndexName/settings",
"path": "/1/indexes/cts_e2e_settings/settings",
"method": "PUT",
"body": {
"paginationLimitedTo": 10
},
"queryParameters": {
"forwardToReplicas": "true"
}
},
"response": {
"statusCode": 200
}
},
{
Expand Down
8 changes: 8 additions & 0 deletions tests/output/javascript/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ export function union(
): Record<string, any> {
const res = {};

if (!expected) {
return expected;
}

if (typeof expected !== 'object' && !Array.isArray(expected)) {
return expected;
}

for (const [key, value] of Object.entries(expected)) {
if (key in received) {
if (Array.isArray(value)) {
Expand Down
4 changes: 2 additions & 2 deletions tests/output/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
argcomplete==3.1.6
click==8.1.7
packaging==23.2
pipx==1.4.1
platformdirs==4.1.0
pipx==1.3.2
platformdirs==4.0.0
userpath==1.9.1
3 changes: 3 additions & 0 deletions tests/output/python/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ def union(self, expected: dict, received: dict) -> dict:
"""
_res = {}

if not isinstance(expected, dict) or not isinstance(received, dict):
return received

for k, v in expected.items():
if k in received:
if isinstance(v, dict):
Expand Down
4 changes: 4 additions & 0 deletions tests/output/ruby/test/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
def union(expected, received)
res = {}

if !expected.is_a?(Array) and !expected.is_a?(Hash)
return expected
end

expected.each do |key, value|
if received.key?(key)
if value.is_a?(Array)
Expand Down

0 comments on commit 4dc28da

Please sign in to comment.