mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-02 03:48:14 +03:00
Rename instances of X-BokutachiIR-Version to X-TachiIR-Version
This commit is contained in:
@@ -6,7 +6,7 @@ t.test("#ValidateIRClientVersion", (t) => {
|
||||
t.test("Should reject clients that are not supported", async (t) => {
|
||||
const { res } = await expMiddlewareMock(ValidateIRClientVersion, {
|
||||
headers: {
|
||||
"X-BokutachiIR-Version": "1.2.0",
|
||||
"X-TachiIR-Version": "1.2.0",
|
||||
},
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ t.test("#ValidateIRClientVersion", (t) => {
|
||||
t.test("Should accept 2.0.0", async (t) => {
|
||||
const { res } = await expMiddlewareMock(ValidateIRClientVersion, {
|
||||
headers: {
|
||||
"X-BokutachiIR-Version": "2.0.0",
|
||||
"X-TachiIR-Version": "2.0.0",
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { RequestHandler } from "express";
|
||||
|
||||
export const ValidateIRClientVersion: RequestHandler = (req, res, next) => {
|
||||
const header = req.header("X-BokutachiIR-Version");
|
||||
const header = req.header("X-TachiIR-Version");
|
||||
|
||||
if (header !== "2.0.0") {
|
||||
return res.status(400).json({
|
||||
|
||||
@@ -36,7 +36,7 @@ t.test("GET /ir/beatoraja/charts/:chartSHA256/scores", (t) => {
|
||||
|
||||
const res = await mockApi
|
||||
.get(`/ir/beatoraja/charts/${GAZER_SHA256}/scores`)
|
||||
.set("X-BokutachiIR-Version", "2.0.0");
|
||||
.set("X-TachiIR-Version", "2.0.0");
|
||||
|
||||
t.equal(res.status, 200);
|
||||
|
||||
@@ -46,7 +46,7 @@ t.test("GET /ir/beatoraja/charts/:chartSHA256/scores", (t) => {
|
||||
t.test("Should return 404 if chart doesnt exist", async (t) => {
|
||||
const res = await mockApi
|
||||
.get(`/ir/beatoraja/charts/INVALID/scores`)
|
||||
.set("X-BokutachiIR-Version", "2.0.0");
|
||||
.set("X-TachiIR-Version", "2.0.0");
|
||||
|
||||
t.equal(res.status, 404);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ t.test("POST /ir/beatoraja/submit-score", (t) => {
|
||||
t.test("Should import a valid score.", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-score")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(scoreReq);
|
||||
|
||||
@@ -61,7 +61,7 @@ t.test("POST /ir/beatoraja/submit-score", (t) => {
|
||||
t.test("Should return an error if invalid client.", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-score")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(deepmerge(scoreReq, { client: "INVALID" }));
|
||||
|
||||
@@ -76,7 +76,7 @@ t.test("POST /ir/beatoraja/submit-score", (t) => {
|
||||
t.test("Should return an error if invalid score.", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-score")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(deepmerge(scoreReq, { score: { exscore: -1 } }));
|
||||
|
||||
@@ -91,7 +91,7 @@ t.test("POST /ir/beatoraja/submit-score", (t) => {
|
||||
t.test("Should return an error if invalid chart.", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-score")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(deepmerge(scoreReq, { chart: { title: null } }));
|
||||
|
||||
@@ -175,7 +175,7 @@ t.test("POST /ir/beatoraja/submit-course", (t) => {
|
||||
t.test("Should accept a valid clear", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-course")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(courseScore);
|
||||
|
||||
@@ -193,7 +193,7 @@ t.test("POST /ir/beatoraja/submit-course", (t) => {
|
||||
t.test("Should silently reject a fail", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-course")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(deepmerge(courseScore, { score: { clear: "Failed" } }));
|
||||
|
||||
@@ -207,7 +207,7 @@ t.test("POST /ir/beatoraja/submit-course", (t) => {
|
||||
t.test("Should reject scores with no charts", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-course")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(deepmerge(courseScore, { course: { charts: [] } }, { arrayMerge: (d, s) => s }));
|
||||
|
||||
@@ -221,7 +221,7 @@ t.test("POST /ir/beatoraja/submit-course", (t) => {
|
||||
t.test("Should reject scores with invalid chart documents", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-course")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(deepmerge(courseScore, { course: { charts: [1, 2, 3, 4] } }));
|
||||
|
||||
@@ -235,7 +235,7 @@ t.test("POST /ir/beatoraja/submit-course", (t) => {
|
||||
t.test("Should reject scores with too many chart documents", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-course")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(
|
||||
deepmerge(courseScore, {
|
||||
@@ -253,7 +253,7 @@ t.test("POST /ir/beatoraja/submit-course", (t) => {
|
||||
t.test("Should reject scores not on LN mode", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-course")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(
|
||||
deepmerge(courseScore, {
|
||||
@@ -273,7 +273,7 @@ t.test("POST /ir/beatoraja/submit-course", (t) => {
|
||||
t.test("Should reject too few constraints", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-course")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(
|
||||
deepmerge(
|
||||
@@ -297,7 +297,7 @@ t.test("POST /ir/beatoraja/submit-course", (t) => {
|
||||
t.test("Should reject non-array constraints", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-course")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(
|
||||
deepmerge(
|
||||
@@ -321,7 +321,7 @@ t.test("POST /ir/beatoraja/submit-course", (t) => {
|
||||
t.test("Should reject too many constraints", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-course")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(
|
||||
deepmerge(
|
||||
@@ -345,7 +345,7 @@ t.test("POST /ir/beatoraja/submit-course", (t) => {
|
||||
t.test("Should reject invalid constraints", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-course")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(
|
||||
deepmerge(
|
||||
@@ -369,7 +369,7 @@ t.test("POST /ir/beatoraja/submit-course", (t) => {
|
||||
t.test("Should reject invalid constraints for 3", async (t) => {
|
||||
const res = await mockApi
|
||||
.post("/ir/beatoraja/submit-course")
|
||||
.set("X-BokutachiIR-Version", "2.0.0")
|
||||
.set("X-TachiIR-Version", "2.0.0")
|
||||
.set("Authorization", "Bearer mock_token")
|
||||
.send(
|
||||
deepmerge(
|
||||
|
||||
Reference in New Issue
Block a user