synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
76 lines (75 loc) • 1.75 kB
JavaScript
import { http as r, HttpResponse as s } from "msw";
import { mockRegisteredChallengeTeams as o, MOCK_CHALLENGE_ID as u } from "../../challenge/mockChallenge.js";
import { MOCK_CHALLENGE_PARTICIPANT_TEAM_ID as c } from "../../team/mockTeam.js";
import g from "../util/BasicMockedCrudService.js";
const a = new g({
initialData: o,
idField: "id",
autoGenerateId: !0
});
function i(e) {
return r.get(
`${e}/repo/v1/entity/:id/challenge`,
({ params: t }) => {
const n = {
id: u,
etag: "f5e9df54-360b-4ede-9a17-f7f5680c8dd4",
projectId: t.id,
participantTeamId: String(c)
};
return s.json(n, { status: 200 });
}
);
}
function d(e) {
return r.get(
`${e}/repo/v1/challenge/:challengeId/challengeTeam`,
() => {
const t = a.getAll(), n = {
results: t,
totalNumberOfResults: t.length
};
return s.json(n, { status: 200 });
}
);
}
function m(e) {
return r.post(
`${e}/repo/v1/challenge/:challengeId/challengeTeam`,
async ({ request: t }) => {
const n = await t.json(), l = a.create({
...n,
etag: "abcdef0987654321"
});
return s.json(l, { status: 200 });
}
);
}
function p(e) {
return r.get(
`${e}/repo/v1/challenge/:challengeId/submissionTeams`,
() => {
const t = {
results: [],
totalNumberOfResults: 0
};
return s.json(t, { status: 200 });
}
);
}
function I(e) {
return [
i(e),
p(e),
m(e),
d(e)
];
}
export {
I as default,
i as getChallengeHandler,
m as getRegisterTeamForChallengeHandler,
d as getRegisteredChallengeTeamsHandler,
p as getSubmissionTeamsHandler
};
//# sourceMappingURL=challengeHandlers.js.map