Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove eslint vitest exceptions #1748

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -724,7 +724,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 @@ -734,7 +734,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 @@ -744,7 +744,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 @@ -754,7 +754,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 @@ -764,7 +764,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 @@ -774,7 +774,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 @@ -784,7 +784,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 @@ -794,7 +794,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 @@ -804,7 +804,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