Skip to content

Commit 998c04b

Browse files
feat: generate mocks for most of the states
1 parent b2fa1d3 commit 998c04b

File tree

16 files changed

+607
-45
lines changed

16 files changed

+607
-45
lines changed

__mocks__/bounty.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { Bounty, BountyCourse } from "@/types/bounty";
2+
import { colors } from "./colors";
3+
import { reward } from "./reward";
4+
import { metadata } from "./community";
5+
6+
const mockBountyCourse: BountyCourse = {
7+
duration: 0,
8+
slug: "",
9+
active: false,
10+
id: "",
11+
ref: "",
12+
created_at: new Date(),
13+
updated_at: new Date(),
14+
summary: "",
15+
level: 0,
16+
name: "",
17+
description: "",
18+
objectives: [],
19+
locale: "",
20+
community: "",
21+
introduction: {
22+
text: ""
23+
},
24+
certificateIcon: "",
25+
certificateData: {
26+
narrative: "",
27+
icon: ""
28+
},
29+
timestamp: 0,
30+
learningModules: [],
31+
translations: []
32+
}
33+
export const mockBounty: Bounty = {
34+
url: "",
35+
image: undefined,
36+
id: "",
37+
ref: "",
38+
created_at: "",
39+
updated_at: "",
40+
icon: "",
41+
active: false,
42+
colors,
43+
description: "",
44+
summary: "",
45+
name: "",
46+
slug: "",
47+
metadata: metadata,
48+
timestamp: 0,
49+
course: mockBountyCourse,
50+
challenge: "",
51+
reward: reward,
52+
community: ""
53+
}
54+
export const mockTrailer = {
55+
summary: "trailer summary",
56+
description: "trailer descriptio",
57+
video: "trailer video",
58+
duration: 4,
59+
info: {
60+
items: ["item 1", "item 2"],
61+
title: "info title",
62+
},
63+
};

__mocks__/challenge.ts

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
import { mockFormat, mockCertificateData, mockCourse, mockLearningModule, mockRatingCriteria } from "./course";
2+
import { mockCommunity, metadata } from "./community";
3+
import { reward } from "./reward";
4+
import { Submission } from "@/types/bounty";
5+
import { AdditionalInfo, Challenge } from "@/types/course";
6+
import { TEAM_FORMATION } from "@/constants/challengeInfo";
7+
import { Team, TeamMember } from "@/types/challenge";
8+
import { Feedback } from "@/types/feedback";
9+
import { mockUser } from "./user";
10+
11+
12+
13+
export const mockAdditionalInfo: { [type: string]: AdditionalInfo } = {
14+
"type": { type: "additional type", text: "additional text" },
15+
}
16+
17+
export const challenge: Challenge = {
18+
id: "challenge",
19+
ref: "challenge ref",
20+
created_at: new Date("2022-05-01T12:00:00Z"),
21+
updated_at: new Date("2022-05-01T12:00:00Z"),
22+
hint: "Hint",
23+
name: "challenge name",
24+
format: mockFormat,
25+
description: "challenge description",
26+
course: mockCourse,
27+
type: "course",
28+
isTeamChallenge: false,
29+
objectives: ["objectives 1", "Objectives 2", "Objectives 3", "Objectives 4"],
30+
threshold: 8,
31+
community: mockCommunity,
32+
reviewTime: 9,
33+
metadata: metadata,
34+
level: 58,
35+
courses: [mockCourse],
36+
learningModules: [mockLearningModule],
37+
expiresAt: "2025",
38+
reward: reward,
39+
certificateIcon: "certificate",
40+
certificateData: mockCertificateData,
41+
ratingCriteria: [mockRatingCriteria],
42+
timestamp: 6,
43+
maxPoints: 299,
44+
minPoints: 9,
45+
rewards: [reward],
46+
feedbacks: {},
47+
feedbackInfo: [{}],
48+
bestSubmissions: [{}],
49+
teamLimit: 5,
50+
isHackathon: false,
51+
additionalInfo: {
52+
[TEAM_FORMATION]: {
53+
type: 'teamFormation',
54+
text: 'Form your team details here'
55+
}
56+
}
57+
};
58+
59+
export const submission: Submission = {
60+
length: 0,
61+
id: "submission_id",
62+
ref: "reference",
63+
created_at: new Date("2022-05-01T12:00:00Z"),
64+
updated_at: new Date("2022-05-01T12:00:00Z"),
65+
link: "/submissions/reference",
66+
community: mockCommunity,
67+
user_id: "user_id",
68+
challenge: challenge,
69+
text: "Submission",
70+
reviewDeadline: new Date(),
71+
metadata: {
72+
evaluation: "",
73+
applicableReward: {
74+
ref: "",
75+
amount: 0,
76+
updated_at: "",
77+
challenge: "",
78+
created_at: "",
79+
id: "",
80+
type: "",
81+
community: "",
82+
timestamp: 0,
83+
token: "",
84+
},
85+
reviewed: false,
86+
feedbacks: 0,
87+
language: "",
88+
},
89+
timestamp: 0,
90+
user: mockUser,
91+
reviewable: false,
92+
status: "",
93+
reward: reward,
94+
map: function () {
95+
throw new Error("Function not implemented.");
96+
},
97+
};
98+
99+
export const mockInvite = {
100+
created_at: "tuesday",
101+
id: "invite",
102+
ref: "invitation ref",
103+
status: "invitation status",
104+
team_ref: "team reference",
105+
timestamp: 3,
106+
updated_at: "wednesday",
107+
user: mockUser,
108+
user_id: "user id",
109+
}
110+
111+
export const mockTeamMember: TeamMember = {
112+
created_at: "created_at",
113+
id: "id",
114+
joined_on: "joined_on",
115+
ref: "ref",
116+
team_ref: "team reference",
117+
timestamp: 3,
118+
updated_at: "wednesday",
119+
user: mockUser,
120+
}
121+
122+
export const mockTeam: Team = {
123+
challenge: challenge,
124+
challenge_ref: "challenge ref",
125+
created_at: "created at",
126+
id: "id",
127+
locked: true,
128+
name: "Master",
129+
organizer: mockUser,
130+
organizer_id: "organizer id",
131+
invites: [mockInvite],
132+
members: [mockTeamMember],
133+
ref: "",
134+
timestamp: "",
135+
updated_at: ""
136+
}
137+
138+
export const mockFeedback: Feedback = {
139+
submission: submission,
140+
id: "234-4231243",
141+
ref: "feedbacks/234-4231243",
142+
created_at: new Date(),
143+
updated_at: "",
144+
criteria: ["criteria 1", "criteria 2"],
145+
positive: false,
146+
name: "The person who made a submission",
147+
challenge: "challenge name",
148+
timestamp: undefined,
149+
user: mockUser,
150+
ranking: 0,
151+
text: "I am providing a feedback"
152+
}

__mocks__/community.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { Community } from "@/types/community";
2+
import { colors } from "./colors";
3+
4+
export const metadata = {
5+
invite_id: "abc123",
6+
submissions: 5,
7+
bestSubmissions: ["submission1", "submission2"],
8+
feedbacks: 10,
9+
name: "Project XYZ",
10+
issuedOn: "2024-01-29T12:00:00Z",
11+
image: "image_url",
12+
title: "Title of the project",
13+
description: "Description of the project",
14+
narrative: "Narrative of the project",
15+
recipientName: "John Doe",
16+
issuerName: "Jane Smith",
17+
comment: "This is a comment",
18+
linkToWork: "link_to_work",
19+
submission: "submission_details",
20+
};
21+
22+
const reward = {
23+
id: "123456789",
24+
ref: "ref123",
25+
created_at: new Date("2024-01-29T08:00:00Z"),
26+
updated_at: new Date("2024-01-29T08:30:00Z"),
27+
challenge: "Challenge Name",
28+
type: "SUBMISSION",
29+
community: "Community Name",
30+
token: "Token ID",
31+
stable: true,
32+
amount: 100,
33+
timestamp: 1643424000,
34+
};
35+
36+
export const mockCommunity: Community = {
37+
id: "ew-43",
38+
ref: "community/ref",
39+
created_at: new Date("2022-05-01T12:00:00Z"),
40+
updated_at: new Date("2022-05-01T12:00:00Z"),
41+
summary: "this is the summary",
42+
icon: "public/img/communities/aeternity.svg",
43+
name: "aeternity",
44+
image: "public/img/communities/aeternity.svg",
45+
colors: colors,
46+
slug: "ae",
47+
active: true,
48+
description: "this is a aeternity community",
49+
metadata,
50+
timestamp: 182044800000,
51+
rewards: [reward],
52+
reward,
53+
courses: 3,
54+
duration: 4,
55+
can_mint_certificates: true,
56+
challenges: 3,
57+
};

0 commit comments

Comments
 (0)