Test files usually contain a set of the following tests:
describe.each([
{ host: BAD_HOST, trailing: false },
{ host: `${BAD_HOST}/api`, trailing: false },
{ host: `${BAD_HOST}/trailing/`, trailing: true },
])("Tests on url construction", ({ host, trailing }) => {
test(`get search route`, async () => {
// ...
});
test(`post search route`, async () => {
// ...
});
});
These tests always do the same thing on each method: create the client with an unreachable host, call method, get MeiliSearchRequestError, check that its message contains this unreachable path.
I believe it is enough to test one method to see if MeiliSearchRequestError is properly formed, for the rest it should be implicit that it works the same way, since all of these methods rely on the same http request class.
- API errors regarding insufficient permission level
describe.each([{ permission: "No" }])(
"Test on searchable attributes",
({ permission }) => {
test(`${permission} key: try to get searchable attributes and be denied`, async () => {
// ...
});
test(`${permission} key: try to update searchable attributes and be denied`, async () => {
// ...
});
test(`${permission} key: try to reset searchable attributes and be denied`, async () => {
// ...
});
},
);
More or less the same thing happens here as in the previous problem. We rely on the same class. It is enough to check once whether MeiliSearchApiError is well formed. The rest can stay implicit.
Test files usually contain a set of the following tests:
These tests always do the same thing on each method: create the client with an unreachable host, call method, get
MeiliSearchRequestError, check that its message contains this unreachable path.I believe it is enough to test one method to see if
MeiliSearchRequestErroris properly formed, for the rest it should be implicit that it works the same way, since all of these methods rely on the same http request class.More or less the same thing happens here as in the previous problem. We rely on the same class. It is enough to check once whether
MeiliSearchApiErroris well formed. The rest can stay implicit.