DEV: Remove invalid pretender calls (#18341)

Get parameters cannot be included in the URL of request stubs. Instead, the callback can check `request.queryParams` to modify behavior.
This commit is contained in:
David Taylor 2022-09-23 12:07:23 +01:00 committed by GitHub
parent 7277a9fbb3
commit 8964749989
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 11 deletions

View File

@ -8,9 +8,6 @@ import { test } from "qunit";
acceptance("Redirect to Top", function (needs) {
needs.pretender((server, helper) => {
server.get("/top.json?period=weekly", () => {
return helper.response(DiscoveryFixtures["/latest.json"]);
});
server.get("/top/monthly.json", () => {
return helper.response(DiscoveryFixtures["/latest.json"]);
});

View File

@ -201,15 +201,11 @@ acceptance("Topic Discovery | Footer", function (needs) {
});
needs.pretender((server, helper) => {
server.get("/c/dev/7/l/latest.json", () => {
server.get("/c/dev/7/l/latest.json", (request) => {
const json = cloneJSON(discoveryFixtures["/c/dev/7/l/latest.json"]);
json.topic_list.more_topics_url = "/c/dev/7/l/latest.json?page=2";
return helper.response(json);
});
server.get("/c/dev/7/l/latest.json?page=2", () => {
const json = cloneJSON(discoveryFixtures["/c/dev/7/l/latest.json"]);
json.topic_list.more_topics_url = null;
if (!request.queryParams.page) {
json.topic_list.more_topics_url = "/c/dev/7/l/latest.json?page=2";
}
return helper.response(json);
});
});