-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
450 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import slugHandler from "@/pages/api/lanes/[slug]"; | ||
import { NextApiRequest } from "next"; | ||
|
||
it("should respond with 200 status and lanes data for a GET request", () => { | ||
const request: NextApiRequest = { | ||
method: "GET", | ||
query: { | ||
slug: "maps", | ||
}, | ||
} as unknown as NextApiRequest; | ||
|
||
const mockResponse: any = { | ||
status: jest.fn(function () { | ||
return this; | ||
}), | ||
json: jest.fn(), | ||
}; | ||
|
||
slugHandler(request, mockResponse); | ||
|
||
expect(mockResponse.status).toHaveBeenCalledWith(200); | ||
}); | ||
|
||
it("should respond with an error for nonexistent slugs", () => { | ||
const request: NextApiRequest = { | ||
method: "GET", | ||
query: { | ||
slug: "not-a-slug", | ||
}, | ||
} as unknown as NextApiRequest; | ||
|
||
const mockResponse: any = { | ||
status: jest.fn(function () { | ||
return this; | ||
}), | ||
json: jest.fn(), | ||
}; | ||
|
||
slugHandler(request, mockResponse); | ||
|
||
expect(mockResponse.status).toHaveBeenCalledWith(404); | ||
expect(mockResponse.json).toHaveBeenCalledWith({ error: "Lane not found" }); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { getItemsData } from "@/pages/api/featuredItems"; | ||
import itemsDataHandler from "@/pages/api/featuredItems"; | ||
import { NextApiRequest } from "next"; | ||
|
||
describe("Featured items API endpoint handler", () => { | ||
it("should respond with 200 status and items data for a GET request", () => { | ||
const request: NextApiRequest = { | ||
method: "GET", | ||
} as NextApiRequest; | ||
|
||
const mockResponse: any = { | ||
status: jest.fn(function () { | ||
return this; | ||
}), | ||
json: jest.fn(), | ||
}; | ||
|
||
itemsDataHandler(request, mockResponse); | ||
|
||
expect(mockResponse.status).toHaveBeenCalledWith(200); | ||
expect(mockResponse.json).toHaveBeenCalledWith(getItemsData()); | ||
}); | ||
|
||
it("should respond with an error for non-GET requests", () => { | ||
const request: NextApiRequest = { | ||
method: "POST", | ||
} as NextApiRequest; | ||
|
||
const mockResponse: any = { | ||
status: jest.fn(function () { | ||
return this; | ||
}), | ||
}; | ||
|
||
itemsDataHandler(request, mockResponse); | ||
|
||
expect(mockResponse.status).not.toHaveBeenCalledWith(200); | ||
}); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
User-agent: Bytedance | ||
Disallow: / | ||
|
||
User-agent: Bytespider | ||
Disallow: / | ||
|
||
User-agent: GPTBot | ||
Disallow: / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
{ | ||
"featuredItems": { | ||
"images": [ | ||
"105180.jpg", | ||
"105196.jpg", | ||
"105224.jpg", | ||
"105226.jpg", | ||
"1108684.jpg", | ||
"1161044.jpg", | ||
"1161045.jpg", | ||
"1221632.jpg", | ||
"1260009.jpg", | ||
"1269908.jpg", | ||
"1536497.jpg", | ||
"1536861.jpg", | ||
"1549431.jpg", | ||
"1557804.jpg", | ||
"1558053.jpg", | ||
"1657176.jpg", | ||
"1693502.jpg", | ||
"4000175.jpg", | ||
"405476.jpg", | ||
"417074.jpg", | ||
"419720.jpg", | ||
"433221.jpg", | ||
"433223.jpg", | ||
"434110.jpg", | ||
"434408.jpg", | ||
"464341.jpg", | ||
"465012.jpg", | ||
"482599.jpg", | ||
"482603.jpg", | ||
"482752.jpg", | ||
"482815.jpg", | ||
"483644.jpg", | ||
"5013067.jpg", | ||
"5082781.jpg", | ||
"5086214.jpg", | ||
"5104191.jpg", | ||
"5131004.jpg", | ||
"5150304.jpg", | ||
"5164274.jpg", | ||
"5164604.jpg", | ||
"5164631.jpg", | ||
"5179778.jpg", | ||
"5179798.jpg", | ||
"5180605.jpg", | ||
"5273165.jpg", | ||
"5339958.jpg", | ||
"53926.jpg", | ||
"54528.jpg", | ||
"54795.jpg", | ||
"700179F.jpg", | ||
"79781.jpg", | ||
"79849.jpg", | ||
"836151.jpg", | ||
"G91F075_038F.jpg", | ||
"M_1260849.jpg", | ||
"T000725.jpg", | ||
"nypl_mss_901.jpg", | ||
"ps_mss_831.jpg", | ||
"ps_prn_cd31_456.jpg", | ||
"ps_prn_cd32_461.jpg", | ||
"psnypl_dan_1757.jpg", | ||
"psnypl_mss_1228.jpg", | ||
"psnypl_spn_610.jpg" | ||
], | ||
"noIndex": { | ||
"images": [ | ||
"105069.jpg", | ||
"1558052.jpg", | ||
"1582228.jpg", | ||
"435037.jpg", | ||
"465016.jpg", | ||
"482602.jpg", | ||
"5002508.jpg", | ||
"5013067.jpg", | ||
"5086214.jpg", | ||
"5164590.jpg", | ||
"5164599.jpg", | ||
"5164608.jpg", | ||
"5316870.jpg", | ||
"53901.jpg", | ||
"87300.jpg", | ||
"G91F380_080F.jpg", | ||
"den_1409v.jpg", | ||
"psnypl_the_4323.jpg", | ||
"swope_246124.jpg", | ||
"th-16090.jpg", | ||
"trouvelot_003.jpg", | ||
"trouvelot_010.jpg" | ||
] | ||
} | ||
} | ||
} |
Oops, something went wrong.