Skip to content

Commit

Permalink
Merge branch 'main' into improve-http-request
Browse files Browse the repository at this point in the history
  • Loading branch information
flevi29 committed Oct 14, 2024
2 parents 2d4849d + c49c0b5 commit 8825781
Show file tree
Hide file tree
Showing 30 changed files with 118 additions and 112 deletions.
8 changes: 1 addition & 7 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,7 @@ module.exports = [
{
files: ["tests/*.ts"],
plugins: { vitest },
rules: {
...vitest.configs.recommended.rules,
// @TODO: Remove all of these rules and adapt code!
"vitest/expect-expect": "off",
"vitest/valid-title": "off",
"vitest/valid-expect": "off",
},
rules: vitest.configs.recommended.rules,
},
prettier,
];
18 changes: 9 additions & 9 deletions tests/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ describe.each([
{ host: `${BAD_HOST}/api`, trailing: false },
{ host: `${BAD_HOST}/trailing/`, trailing: true },
])("Tests on url construction", ({ host, trailing }) => {
test(`Test getIndex route`, async () => {
test(`getIndex route`, async () => {
const route = `indexes/${indexPk.uid}`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -813,7 +813,7 @@ describe.each([
);
});

test(`Test createIndex route`, async () => {
test(`createIndex route`, async () => {
const route = `indexes`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -823,7 +823,7 @@ describe.each([
);
});

test(`Test updateIndex route`, async () => {
test(`updateIndex route`, async () => {
const route = `indexes/${indexPk.uid}`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -833,7 +833,7 @@ describe.each([
);
});

test(`Test deleteIndex route`, async () => {
test(`deleteIndex route`, async () => {
const route = `indexes/${indexPk.uid}`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -843,7 +843,7 @@ describe.each([
);
});

test(`Test get indexes route`, async () => {
test(`get indexes route`, async () => {
const route = `indexes`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -853,7 +853,7 @@ describe.each([
);
});

test(`Test getKeys route`, async () => {
test(`getKeys route`, async () => {
const route = `keys`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -863,7 +863,7 @@ describe.each([
);
});

test(`Test health route`, async () => {
test(`health route`, async () => {
const route = `health`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -873,7 +873,7 @@ describe.each([
);
});

test(`Test stats route`, async () => {
test(`stats route`, async () => {
const route = `stats`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -883,7 +883,7 @@ describe.each([
);
});

test(`Test version route`, async () => {
test(`version route`, async () => {
const route = `version`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand Down
6 changes: 3 additions & 3 deletions tests/dictionary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe.each([
{ host: `${BAD_HOST}/api`, trailing: false },
{ host: `${BAD_HOST}/trailing/`, trailing: true },
])("Tests on url construction", ({ host, trailing }) => {
test(`Test getDictionary route`, async () => {
test(`getDictionary route`, async () => {
const route = `indexes/${index.uid}/settings/dictionary`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -90,7 +90,7 @@ describe.each([
);
});

test(`Test updateDictionary route`, async () => {
test(`updateDictionary route`, async () => {
const route = `indexes/${index.uid}/settings/dictionary`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -102,7 +102,7 @@ describe.each([
);
});

test(`Test resetDictionary route`, async () => {
test(`resetDictionary route`, async () => {
const route = `indexes/${index.uid}/settings/dictionary`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand Down
6 changes: 3 additions & 3 deletions tests/displayed_attributes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ describe.each([
{ host: `${BAD_HOST}/api`, trailing: false },
{ host: `${BAD_HOST}/trailing/`, trailing: true },
])("Tests on url construction", ({ host, trailing }) => {
test(`Test getDisplayedAttributes route`, async () => {
test(`getDisplayedAttributes route`, async () => {
const route = `indexes/${index.uid}/settings/displayed-attributes`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -165,7 +165,7 @@ describe.each([
);
});

test(`Test updateDisplayedAttributes route`, async () => {
test(`updateDisplayedAttributes route`, async () => {
const route = `indexes/${index.uid}/settings/displayed-attributes`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -177,7 +177,7 @@ describe.each([
);
});

test(`Test resetDisplayedAttributes route`, async () => {
test(`resetDisplayedAttributes route`, async () => {
const route = `indexes/${index.uid}/settings/displayed-attributes`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand Down
6 changes: 3 additions & 3 deletions tests/distinct_attribute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ describe.each([
{ host: `${BAD_HOST}/api`, trailing: false },
{ host: `${BAD_HOST}/trailing/`, trailing: true },
])("Tests on url construction", ({ host, trailing }) => {
test(`Test getDistinctAttribute route`, async () => {
test(`getDistinctAttribute route`, async () => {
const route = `indexes/${index.uid}/settings/distinct-attribute`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -155,7 +155,7 @@ describe.each([
);
});

test(`Test updateDistinctAttribute route`, async () => {
test(`updateDistinctAttribute route`, async () => {
const route = `indexes/${index.uid}/settings/distinct-attribute`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -167,7 +167,7 @@ describe.each([
);
});

test(`Test resetDistinctAttribute route`, async () => {
test(`resetDistinctAttribute route`, async () => {
const route = `indexes/${index.uid}/settings/distinct-attribute`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand Down
16 changes: 8 additions & 8 deletions tests/documents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili
{ host: `${BAD_HOST}/api`, trailing: false },
{ host: `${BAD_HOST}/trailing/`, trailing: true },
])("Tests on url construction", ({ host, trailing }) => {
test(`Test getDocument route`, async () => {
test(`getDocument route`, async () => {
const route = `indexes/${indexPk.uid}/documents/1`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -999,7 +999,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili
);
});

test(`Test getDocuments route`, async () => {
test(`getDocuments route`, async () => {
const route = `indexes/${indexPk.uid}/documents`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -1011,7 +1011,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili
);
});

test(`Test addDocuments route`, async () => {
test(`addDocuments route`, async () => {
const route = `indexes/${indexPk.uid}/documents`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -1023,7 +1023,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili
);
});

test(`Test updateDocuments route`, async () => {
test(`updateDocuments route`, async () => {
const route = `indexes/${indexPk.uid}/documents`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -1035,7 +1035,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili
);
});

test(`Test deleteDocument route`, async () => {
test(`deleteDocument route`, async () => {
const route = `indexes/${indexPk.uid}/documents/1`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -1047,7 +1047,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili
);
});

test(`Test deleteDocuments route`, async () => {
test(`deleteDocuments route`, async () => {
const route = `indexes/${indexPk.uid}/documents/delete-batch`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -1059,7 +1059,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili
);
});

test(`Test deleteAllDocuments route`, async () => {
test(`deleteAllDocuments route`, async () => {
const route = `indexes/${indexPk.uid}/documents`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -1071,7 +1071,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili
);
});

test(`Test updateDocumentsByFunction route`, async () => {
test(`updateDocumentsByFunction route`, async () => {
const route = `indexes/${indexPk.uid}/documents/edit`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand Down
10 changes: 6 additions & 4 deletions tests/dump.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test, describe, beforeEach } from "vitest";
import { ErrorStatusCode } from "../src/types";
import { ErrorStatusCode, TaskStatus } from "../src/types";
import {
clearAllIndexes,
config,
Expand All @@ -13,13 +13,15 @@ beforeEach(async () => {
});

describe.each([{ permission: "Master" }, { permission: "Admin" }])(
"Test on dump",
"Test on dump should succeed with right permission",
({ permission }) => {
test(`${permission} key: create a new dump`, async () => {
const client = await getClient(permission);
const { taskUid } = await client.createDump();

await client.waitForTask(taskUid);
const taskResult = await client.waitForTask(taskUid);

expect(taskResult).toHaveProperty("status", TaskStatus.TASK_SUCCEEDED);
});
},
);
Expand Down Expand Up @@ -55,7 +57,7 @@ describe.each([
{ host: `${BAD_HOST}/api`, trailing: false },
{ host: `${BAD_HOST}/trailing/`, trailing: true },
])("Tests on url construction", ({ host, trailing }) => {
test(`Test createDump route`, async () => {
test(`createDump route`, async () => {
const route = `dumps`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand Down
6 changes: 3 additions & 3 deletions tests/embedders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ describe.each([
{ host: `${BAD_HOST}/api`, trailing: false },
{ host: `${BAD_HOST}/trailing/`, trailing: true },
])("Tests on url construction", ({ host, trailing }) => {
test(`Test getEmbedders route`, async () => {
test(`getEmbedders route`, async () => {
const route = `indexes/${index.uid}/settings/embedders`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -315,7 +315,7 @@ describe.each([
);
});

test(`Test updateEmbedders route`, async () => {
test(`updateEmbedders route`, async () => {
const route = `indexes/${index.uid}/settings/embedders`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -327,7 +327,7 @@ describe.each([
);
});

test(`Test resetEmbedders route`, async () => {
test(`resetEmbedders route`, async () => {
const route = `indexes/${index.uid}/settings/embedders`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand Down
6 changes: 3 additions & 3 deletions tests/faceting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe.each([
{ host: `${BAD_HOST}/api`, trailing: false },
{ host: `${BAD_HOST}/trailing/`, trailing: true },
])("Tests on url construction", ({ host, trailing }) => {
test(`Test getFaceting route`, async () => {
test(`getFaceting route`, async () => {
const route = `indexes/${index.uid}/settings/faceting`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -177,7 +177,7 @@ describe.each([
);
});

test(`Test updateFaceting route`, async () => {
test(`updateFaceting route`, async () => {
const route = `indexes/${index.uid}/settings/faceting`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -189,7 +189,7 @@ describe.each([
);
});

test(`Test resetFaceting route`, async () => {
test(`resetFaceting route`, async () => {
const route = `indexes/${index.uid}/settings/faceting`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand Down
6 changes: 3 additions & 3 deletions tests/filterable_attributes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe.each([
{ host: `${BAD_HOST}/api`, trailing: false },
{ host: `${BAD_HOST}/trailing/`, trailing: true },
])("Tests on url construction", ({ host, trailing }) => {
test(`Test getFilterableAttributes route`, async () => {
test(`getFilterableAttributes route`, async () => {
const route = `indexes/${index.uid}/settings/filterable-attributes`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -167,7 +167,7 @@ describe.each([
);
});

test(`Test updateFilterableAttributes route`, async () => {
test(`updateFilterableAttributes route`, async () => {
const route = `indexes/${index.uid}/settings/filterable-attributes`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -179,7 +179,7 @@ describe.each([
);
});

test(`Test resetFilterableAttributes route`, async () => {
test(`resetFilterableAttributes route`, async () => {
const route = `indexes/${index.uid}/settings/filterable-attributes`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand Down
4 changes: 2 additions & 2 deletions tests/get_search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ describe.each([
{ host: `${BAD_HOST}/api`, trailing: false },
{ host: `${BAD_HOST}/trailing/`, trailing: true },
])("Tests on url construction", ({ host, trailing }) => {
test(`Test get search route`, async () => {
test(`get search route`, async () => {
const route = `indexes/${index.uid}/search`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand All @@ -600,7 +600,7 @@ describe.each([
);
});

test(`Test post search route`, async () => {
test(`post search route`, async () => {
const route = `indexes/${index.uid}/search`;
const client = new MeiliSearch({ host });
const strippedHost = trailing ? host.slice(0, -1) : host;
Expand Down
Loading

0 comments on commit 8825781

Please sign in to comment.