Skip to content

Commit c49c0b5

Browse files
Merge #1748
1748: Remove eslint vitest exceptions r=flevi29 a=Barabasbalazs # Pull Request ## Related issue Fixes #1745 ## What does this PR do? - Removed the vitest exceptions from the eslint config and addapted the tests accordingly ## PR checklist Please check if your PR fulfills the following requirements: - [X] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [X] Have you read the contributing guidelines? - [X] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: Balazs Barabas <[email protected]>
2 parents bc97969 + a8c5010 commit c49c0b5

30 files changed

+118
-112
lines changed

eslint.config.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,7 @@ module.exports = [
6363
{
6464
files: ["tests/*.ts"],
6565
plugins: { vitest },
66-
rules: {
67-
...vitest.configs.recommended.rules,
68-
// @TODO: Remove all of these rules and adapt code!
69-
"vitest/expect-expect": "off",
70-
"vitest/valid-title": "off",
71-
"vitest/valid-expect": "off",
72-
},
66+
rules: vitest.configs.recommended.rules,
7367
},
7468
prettier,
7569
];

tests/client.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ describe.each([
724724
{ host: `${BAD_HOST}/api`, trailing: false },
725725
{ host: `${BAD_HOST}/trailing/`, trailing: true },
726726
])("Tests on url construction", ({ host, trailing }) => {
727-
test(`Test getIndex route`, async () => {
727+
test(`getIndex route`, async () => {
728728
const route = `indexes/${indexPk.uid}`;
729729
const client = new MeiliSearch({ host });
730730
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -734,7 +734,7 @@ describe.each([
734734
);
735735
});
736736

737-
test(`Test createIndex route`, async () => {
737+
test(`createIndex route`, async () => {
738738
const route = `indexes`;
739739
const client = new MeiliSearch({ host });
740740
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -744,7 +744,7 @@ describe.each([
744744
);
745745
});
746746

747-
test(`Test updateIndex route`, async () => {
747+
test(`updateIndex route`, async () => {
748748
const route = `indexes/${indexPk.uid}`;
749749
const client = new MeiliSearch({ host });
750750
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -754,7 +754,7 @@ describe.each([
754754
);
755755
});
756756

757-
test(`Test deleteIndex route`, async () => {
757+
test(`deleteIndex route`, async () => {
758758
const route = `indexes/${indexPk.uid}`;
759759
const client = new MeiliSearch({ host });
760760
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -764,7 +764,7 @@ describe.each([
764764
);
765765
});
766766

767-
test(`Test get indexes route`, async () => {
767+
test(`get indexes route`, async () => {
768768
const route = `indexes`;
769769
const client = new MeiliSearch({ host });
770770
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -774,7 +774,7 @@ describe.each([
774774
);
775775
});
776776

777-
test(`Test getKeys route`, async () => {
777+
test(`getKeys route`, async () => {
778778
const route = `keys`;
779779
const client = new MeiliSearch({ host });
780780
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -784,7 +784,7 @@ describe.each([
784784
);
785785
});
786786

787-
test(`Test health route`, async () => {
787+
test(`health route`, async () => {
788788
const route = `health`;
789789
const client = new MeiliSearch({ host });
790790
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -794,7 +794,7 @@ describe.each([
794794
);
795795
});
796796

797-
test(`Test stats route`, async () => {
797+
test(`stats route`, async () => {
798798
const route = `stats`;
799799
const client = new MeiliSearch({ host });
800800
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -804,7 +804,7 @@ describe.each([
804804
);
805805
});
806806

807-
test(`Test version route`, async () => {
807+
test(`version route`, async () => {
808808
const route = `version`;
809809
const client = new MeiliSearch({ host });
810810
const strippedHost = trailing ? host.slice(0, -1) : host;

tests/dictionary.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe.each([
7878
{ host: `${BAD_HOST}/api`, trailing: false },
7979
{ host: `${BAD_HOST}/trailing/`, trailing: true },
8080
])("Tests on url construction", ({ host, trailing }) => {
81-
test(`Test getDictionary route`, async () => {
81+
test(`getDictionary route`, async () => {
8282
const route = `indexes/${index.uid}/settings/dictionary`;
8383
const client = new MeiliSearch({ host });
8484
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -90,7 +90,7 @@ describe.each([
9090
);
9191
});
9292

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

105-
test(`Test resetDictionary route`, async () => {
105+
test(`resetDictionary route`, async () => {
106106
const route = `indexes/${index.uid}/settings/dictionary`;
107107
const client = new MeiliSearch({ host });
108108
const strippedHost = trailing ? host.slice(0, -1) : host;

tests/displayed_attributes.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ describe.each([
153153
{ host: `${BAD_HOST}/api`, trailing: false },
154154
{ host: `${BAD_HOST}/trailing/`, trailing: true },
155155
])("Tests on url construction", ({ host, trailing }) => {
156-
test(`Test getDisplayedAttributes route`, async () => {
156+
test(`getDisplayedAttributes route`, async () => {
157157
const route = `indexes/${index.uid}/settings/displayed-attributes`;
158158
const client = new MeiliSearch({ host });
159159
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -165,7 +165,7 @@ describe.each([
165165
);
166166
});
167167

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

180-
test(`Test resetDisplayedAttributes route`, async () => {
180+
test(`resetDisplayedAttributes route`, async () => {
181181
const route = `indexes/${index.uid}/settings/displayed-attributes`;
182182
const client = new MeiliSearch({ host });
183183
const strippedHost = trailing ? host.slice(0, -1) : host;

tests/distinct_attribute.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ describe.each([
143143
{ host: `${BAD_HOST}/api`, trailing: false },
144144
{ host: `${BAD_HOST}/trailing/`, trailing: true },
145145
])("Tests on url construction", ({ host, trailing }) => {
146-
test(`Test getDistinctAttribute route`, async () => {
146+
test(`getDistinctAttribute route`, async () => {
147147
const route = `indexes/${index.uid}/settings/distinct-attribute`;
148148
const client = new MeiliSearch({ host });
149149
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -155,7 +155,7 @@ describe.each([
155155
);
156156
});
157157

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

170-
test(`Test resetDistinctAttribute route`, async () => {
170+
test(`resetDistinctAttribute route`, async () => {
171171
const route = `indexes/${index.uid}/settings/distinct-attribute`;
172172
const client = new MeiliSearch({ host });
173173
const strippedHost = trailing ? host.slice(0, -1) : host;

tests/documents.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili
987987
{ host: `${BAD_HOST}/api`, trailing: false },
988988
{ host: `${BAD_HOST}/trailing/`, trailing: true },
989989
])("Tests on url construction", ({ host, trailing }) => {
990-
test(`Test getDocument route`, async () => {
990+
test(`getDocument route`, async () => {
991991
const route = `indexes/${indexPk.uid}/documents/1`;
992992
const client = new MeiliSearch({ host });
993993
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -999,7 +999,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili
999999
);
10001000
});
10011001

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

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

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

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

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

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

1074-
test(`Test updateDocumentsByFunction route`, async () => {
1074+
test(`updateDocumentsByFunction route`, async () => {
10751075
const route = `indexes/${indexPk.uid}/documents/edit`;
10761076
const client = new MeiliSearch({ host });
10771077
const strippedHost = trailing ? host.slice(0, -1) : host;

tests/dump.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, test, describe, beforeEach } from "vitest";
2-
import { ErrorStatusCode } from "../src/types";
2+
import { ErrorStatusCode, TaskStatus } from "../src/types";
33
import {
44
clearAllIndexes,
55
config,
@@ -13,13 +13,15 @@ beforeEach(async () => {
1313
});
1414

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

22-
await client.waitForTask(taskUid);
22+
const taskResult = await client.waitForTask(taskUid);
23+
24+
expect(taskResult).toHaveProperty("status", TaskStatus.TASK_SUCCEEDED);
2325
});
2426
},
2527
);
@@ -55,7 +57,7 @@ describe.each([
5557
{ host: `${BAD_HOST}/api`, trailing: false },
5658
{ host: `${BAD_HOST}/trailing/`, trailing: true },
5759
])("Tests on url construction", ({ host, trailing }) => {
58-
test(`Test createDump route`, async () => {
60+
test(`createDump route`, async () => {
5961
const route = `dumps`;
6062
const client = new MeiliSearch({ host });
6163
const strippedHost = trailing ? host.slice(0, -1) : host;

tests/embedders.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ describe.each([
305305
{ host: `${BAD_HOST}/api`, trailing: false },
306306
{ host: `${BAD_HOST}/trailing/`, trailing: true },
307307
])("Tests on url construction", ({ host, trailing }) => {
308-
test(`Test getEmbedders route`, async () => {
308+
test(`getEmbedders route`, async () => {
309309
const route = `indexes/${index.uid}/settings/embedders`;
310310
const client = new MeiliSearch({ host });
311311
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -315,7 +315,7 @@ describe.each([
315315
);
316316
});
317317

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

330-
test(`Test resetEmbedders route`, async () => {
330+
test(`resetEmbedders route`, async () => {
331331
const route = `indexes/${index.uid}/settings/embedders`;
332332
const client = new MeiliSearch({ host });
333333
const strippedHost = trailing ? host.slice(0, -1) : host;

tests/faceting.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ describe.each([
167167
{ host: `${BAD_HOST}/api`, trailing: false },
168168
{ host: `${BAD_HOST}/trailing/`, trailing: true },
169169
])("Tests on url construction", ({ host, trailing }) => {
170-
test(`Test getFaceting route`, async () => {
170+
test(`getFaceting route`, async () => {
171171
const route = `indexes/${index.uid}/settings/faceting`;
172172
const client = new MeiliSearch({ host });
173173
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -177,7 +177,7 @@ describe.each([
177177
);
178178
});
179179

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

192-
test(`Test resetFaceting route`, async () => {
192+
test(`resetFaceting route`, async () => {
193193
const route = `indexes/${index.uid}/settings/faceting`;
194194
const client = new MeiliSearch({ host });
195195
const strippedHost = trailing ? host.slice(0, -1) : host;

tests/filterable_attributes.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ describe.each([
155155
{ host: `${BAD_HOST}/api`, trailing: false },
156156
{ host: `${BAD_HOST}/trailing/`, trailing: true },
157157
])("Tests on url construction", ({ host, trailing }) => {
158-
test(`Test getFilterableAttributes route`, async () => {
158+
test(`getFilterableAttributes route`, async () => {
159159
const route = `indexes/${index.uid}/settings/filterable-attributes`;
160160
const client = new MeiliSearch({ host });
161161
const strippedHost = trailing ? host.slice(0, -1) : host;
@@ -167,7 +167,7 @@ describe.each([
167167
);
168168
});
169169

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

182-
test(`Test resetFilterableAttributes route`, async () => {
182+
test(`resetFilterableAttributes route`, async () => {
183183
const route = `indexes/${index.uid}/settings/filterable-attributes`;
184184
const client = new MeiliSearch({ host });
185185
const strippedHost = trailing ? host.slice(0, -1) : host;

0 commit comments

Comments
 (0)