Skip to content

Commit

Permalink
chore: generated code for commit 4dc28da. [skip ci]
Browse files Browse the repository at this point in the history
Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
  • Loading branch information
algolia-bot and shortcuts committed Jan 9, 2024
1 parent 4dc28da commit c43622f
Show file tree
Hide file tree
Showing 9 changed files with 185 additions and 54 deletions.
12 changes: 6 additions & 6 deletions tests/output/dart/test/requests/search_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,10 @@ void main() {
options: ClientOptions(requester: requester),
),
call: (client) => client.browse(
indexName: "indexName",
indexName: "cts_e2e_browse",
),
intercept: (request) {
expectPath(request.path, '/1/indexes/indexName/browse');
expectPath(request.path, '/1/indexes/cts_e2e_browse/browse');
expect(request.method, 'post');
expectBody(request.body, """{}""");
},
Expand Down Expand Up @@ -1459,10 +1459,10 @@ void main() {
options: ClientOptions(requester: requester),
),
call: (client) => client.getSettings(
indexName: "theIndexName",
indexName: "cts_e2e_settings",
),
intercept: (request) {
expectPath(request.path, '/1/indexes/theIndexName/settings');
expectPath(request.path, '/1/indexes/cts_e2e_settings/settings');
expect(request.method, 'get');
expect(request.body, null);
},
Expand Down Expand Up @@ -3034,14 +3034,14 @@ void main() {
options: ClientOptions(requester: requester),
),
call: (client) => client.setSettings(
indexName: "theIndexName",
indexName: "cts_e2e_settings",
indexSettings: IndexSettings(
paginationLimitedTo: 10,
),
forwardToReplicas: true,
),
intercept: (request) {
expectPath(request.path, '/1/indexes/theIndexName/settings');
expectPath(request.path, '/1/indexes/cts_e2e_settings/settings');
expect(request.method, 'put');
expectParams(
request.queryParameters, """{"forwardToReplicas":"true"}""");
Expand Down
12 changes: 6 additions & 6 deletions tests/output/go/tests/requests/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,13 +428,13 @@ func TestSearch_Browse(t *testing.T) {
{
name: "browse with minimal parameters",
testFunc: func(t *testing.T) {
parametersStr := `{"indexName":"indexName"}`
parametersStr := `{"indexName":"cts_e2e_browse"}`
req := search.ApiBrowseRequest{}
require.NoError(t, json.Unmarshal([]byte(parametersStr), &req))
_, err := client.Browse(req)
require.NoError(t, err)

expectedPath, err := url.QueryUnescape("/1/indexes/indexName/browse")
expectedPath, err := url.QueryUnescape("/1/indexes/cts_e2e_browse/browse")
require.NoError(t, err)
require.Equal(t, expectedPath, echo.path)
require.Equal(t, "POST", echo.method)
Expand Down Expand Up @@ -1594,13 +1594,13 @@ func TestSearch_GetSettings(t *testing.T) {
{
name: "getSettings0",
testFunc: func(t *testing.T) {
parametersStr := `{"indexName":"theIndexName"}`
parametersStr := `{"indexName":"cts_e2e_settings"}`
req := search.ApiGetSettingsRequest{}
require.NoError(t, json.Unmarshal([]byte(parametersStr), &req))
_, err := client.GetSettings(req)
require.NoError(t, err)

expectedPath, err := url.QueryUnescape("/1/indexes/theIndexName/settings")
expectedPath, err := url.QueryUnescape("/1/indexes/cts_e2e_settings/settings")
require.NoError(t, err)
require.Equal(t, expectedPath, echo.path)
require.Equal(t, "GET", echo.method)
Expand Down Expand Up @@ -2955,13 +2955,13 @@ func TestSearch_SetSettings(t *testing.T) {
{
name: "setSettings with minimal parameters",
testFunc: func(t *testing.T) {
parametersStr := `{"indexName":"theIndexName","indexSettings":{"paginationLimitedTo":10},"forwardToReplicas":true}`
parametersStr := `{"indexName":"cts_e2e_settings","indexSettings":{"paginationLimitedTo":10},"forwardToReplicas":true}`
req := search.ApiSetSettingsRequest{}
require.NoError(t, json.Unmarshal([]byte(parametersStr), &req))
_, err := client.SetSettings(req)
require.NoError(t, err)

expectedPath, err := url.QueryUnescape("/1/indexes/theIndexName/settings")
expectedPath, err := url.QueryUnescape("/1/indexes/cts_e2e_settings/settings")
require.NoError(t, err)
require.Equal(t, expectedPath, echo.path)
require.Equal(t, "PUT", echo.method)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,13 @@ void batchDictionaryEntriesTest2() {
@Test
@DisplayName("browse with minimal parameters")
void browseTest0() {
String indexName0 = "indexName";
String indexName0 = "cts_e2e_browse";

assertDoesNotThrow(() -> {
client.browse(indexName0, Object.class);
});
EchoResponse req = echo.getLastResponse();
assertEquals("/1/indexes/indexName/browse", req.path);
assertEquals("/1/indexes/cts_e2e_browse/browse", req.path);
assertEquals("POST", req.method);
assertDoesNotThrow(() -> JSONAssert.assertEquals("{}", req.body, JSONCompareMode.STRICT));
}
Expand Down Expand Up @@ -1645,13 +1645,13 @@ void getRuleTest0() {
@Test
@DisplayName("getSettings0")
void getSettingsTest0() {
String indexName0 = "theIndexName";
String indexName0 = "cts_e2e_settings";

assertDoesNotThrow(() -> {
client.getSettings(indexName0);
});
EchoResponse req = echo.getLastResponse();
assertEquals("/1/indexes/theIndexName/settings", req.path);
assertEquals("/1/indexes/cts_e2e_settings/settings", req.path);
assertEquals("GET", req.method);
assertNull(req.body);
}
Expand Down Expand Up @@ -3692,7 +3692,7 @@ void setDictionarySettingsTest1() {
@Test
@DisplayName("setSettings with minimal parameters")
void setSettingsTest0() {
String indexName0 = "theIndexName";
String indexName0 = "cts_e2e_settings";
IndexSettings indexSettings0 = new IndexSettings();
{
int paginationLimitedTo1 = 10;
Expand All @@ -3704,7 +3704,7 @@ void setSettingsTest0() {
client.setSettings(indexName0, indexSettings0, forwardToReplicas0);
});
EchoResponse req = echo.getLastResponse();
assertEquals("/1/indexes/theIndexName/settings", req.path);
assertEquals("/1/indexes/cts_e2e_settings/settings", req.path);
assertEquals("PUT", req.method);
assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"paginationLimitedTo\":10}", req.body, JSONCompareMode.STRICT));

Expand Down
61 changes: 55 additions & 6 deletions tests/output/javascript/src/requests/search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,26 @@ describe('batchDictionaryEntries', () => {
describe('browse', () => {
test('browse with minimal parameters', async () => {
const req = (await client.browse({
indexName: 'indexName',
indexName: 'cts_e2e_browse',
})) as unknown as EchoResponse;

expect(req.path).toEqual('/1/indexes/indexName/browse');
expect(req.path).toEqual('/1/indexes/cts_e2e_browse/browse');
expect(req.method).toEqual('POST');
expect(req.data).toEqual({});
expect(req.searchParams).toStrictEqual(undefined);

const resp = await e2eClient.browse({ indexName: 'cts_e2e_browse' });

const expectedBody = {
page: 0,
nbHits: 33191,
nbPages: 34,
hitsPerPage: 1000,
query: '',
params: '',
};

expect(expectedBody).toEqual(union(expectedBody, resp));
});

test('browse with search parameters', async () => {
Expand Down Expand Up @@ -976,13 +989,43 @@ describe('getRule', () => {
describe('getSettings', () => {
test('getSettings0', async () => {
const req = (await client.getSettings({
indexName: 'theIndexName',
indexName: 'cts_e2e_settings',
})) as unknown as EchoResponse;

expect(req.path).toEqual('/1/indexes/theIndexName/settings');
expect(req.path).toEqual('/1/indexes/cts_e2e_settings/settings');
expect(req.method).toEqual('GET');
expect(req.data).toEqual(undefined);
expect(req.searchParams).toStrictEqual(undefined);

const resp = await e2eClient.getSettings({ indexName: 'cts_e2e_settings' });

const expectedBody = {
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'],
};

expect(expectedBody).toEqual(union(expectedBody, resp));
});
});

Expand Down Expand Up @@ -2217,15 +2260,21 @@ describe('setDictionarySettings', () => {
describe('setSettings', () => {
test('setSettings with minimal parameters', async () => {
const req = (await client.setSettings({
indexName: 'theIndexName',
indexName: 'cts_e2e_settings',
indexSettings: { paginationLimitedTo: 10 },
forwardToReplicas: true,
})) as unknown as EchoResponse;

expect(req.path).toEqual('/1/indexes/theIndexName/settings');
expect(req.path).toEqual('/1/indexes/cts_e2e_settings/settings');
expect(req.method).toEqual('PUT');
expect(req.data).toEqual({ paginationLimitedTo: 10 });
expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' });

await e2eClient.setSettings({
indexName: 'cts_e2e_settings',
indexSettings: { paginationLimitedTo: 10 },
forwardToReplicas: true,
});
});

test('setSettings allow boolean `typoTolerance`', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,11 @@ class SearchTest {
client.runTest(
call = {
browse(
indexName = "indexName",
indexName = "cts_e2e_browse",
)
},
intercept = {
assertEquals("/1/indexes/indexName/browse".toPathSegments(), it.url.pathSegments)
assertEquals("/1/indexes/cts_e2e_browse/browse".toPathSegments(), it.url.pathSegments)
assertEquals(HttpMethod.parse("POST"), it.method)
assertJsonBody("""{}""", it.body)
},
Expand Down Expand Up @@ -1284,11 +1284,11 @@ class SearchTest {
client.runTest(
call = {
getSettings(
indexName = "theIndexName",
indexName = "cts_e2e_settings",
)
},
intercept = {
assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments)
assertEquals("/1/indexes/cts_e2e_settings/settings".toPathSegments(), it.url.pathSegments)
assertEquals(HttpMethod.parse("GET"), it.method)
assertNoBody(it.body)
},
Expand Down Expand Up @@ -2554,15 +2554,15 @@ class SearchTest {
client.runTest(
call = {
setSettings(
indexName = "theIndexName",
indexName = "cts_e2e_settings",
indexSettings = IndexSettings(
paginationLimitedTo = 10,
),
forwardToReplicas = true,
)
},
intercept = {
assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments)
assertEquals("/1/indexes/cts_e2e_settings/settings".toPathSegments(), it.url.pathSegments)
assertEquals(HttpMethod.parse("PUT"), it.method)
assertContainsAll("""{"forwardToReplicas":"true"}""", it.url.parameters)
assertJsonBody("""{"paginationLimitedTo":10}""", it.body)
Expand Down
38 changes: 32 additions & 6 deletions tests/output/php/src/requests/SearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,16 +488,25 @@ public function testBrowse0()
{
$client = $this->getClient();
$client->browse(
'indexName',
'cts_e2e_browse',
);

$this->assertRequests([
[
'path' => '/1/indexes/indexName/browse',
'path' => '/1/indexes/cts_e2e_browse/browse',
'method' => 'POST',
'body' => json_decode('{}'),
],
]);

$e2eClient = $this->getE2EClient();
$resp = $e2eClient->browse(
'cts_e2e_browse',
);

$expected = json_decode('{"page":0,"nbHits":33191,"nbPages":34,"hitsPerPage":1000,"query":"","params":""}', true);

$this->assertEquals($this->union($expected, $resp), $expected);
}

/**
Expand Down Expand Up @@ -1435,16 +1444,25 @@ public function testGetSettings0()
{
$client = $this->getClient();
$client->getSettings(
'theIndexName',
'cts_e2e_settings',
);

$this->assertRequests([
[
'path' => '/1/indexes/theIndexName/settings',
'path' => '/1/indexes/cts_e2e_settings/settings',
'method' => 'GET',
'body' => null,
],
]);

$e2eClient = $this->getE2EClient();
$resp = $e2eClient->getSettings(
'cts_e2e_settings',
);

$expected = json_decode('{"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"]}', true);

$this->assertEquals($this->union($expected, $resp), $expected);
}

/**
Expand Down Expand Up @@ -2971,20 +2989,28 @@ public function testSetSettings0()
{
$client = $this->getClient();
$client->setSettings(
'theIndexName',
'cts_e2e_settings',
['paginationLimitedTo' => 10,
],
true,
);

$this->assertRequests([
[
'path' => '/1/indexes/theIndexName/settings',
'path' => '/1/indexes/cts_e2e_settings/settings',
'method' => 'PUT',
'body' => json_decode('{"paginationLimitedTo":10}'),
'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true),
],
]);

$e2eClient = $this->getE2EClient();
$resp = $e2eClient->setSettings(
'cts_e2e_settings',
['paginationLimitedTo' => 10,
],
true,
);
}

/**
Expand Down
Loading

0 comments on commit c43622f

Please sign in to comment.