Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions __mocks__/bounty.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const mockTrailer = {
summary: "trailer summary",
description: "trailer description",
video: "trailer video",
duration: 4,
info: {
items: ["item 1", "item 2"],
title: "info title",
},
};
145 changes: 145 additions & 0 deletions __mocks__/challenge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import { TEAM_FORMATION } from "@/constants/challengeInfo";
import { metadata, mockCommunity } from "./community";
import { mockFormat, mockCertificateData, mockCourse, mockLearningModule, mockRatingCriteria } from "./course";
import { reward } from "./reward";
import { Submission, User } from "@/types/bounty";
import { KYCSTATUS } from "@/store/feature/kyc.slice";
import { Team, TeamMember } from "@/types/challenge";

export const mockUser = (): User => ({
id: "user_id",
ref: "ref",
created_at: new Date("2022-05-01T12:00:00Z"),
firstName: "John Doe",
displayName: "John Doe",
uid: "uuid-uuido-232-dex0232-2331",
joined: "14 days ago",
disabled: false,
reputation: 0,
username: "",
lastName: "",
emailVerified: false,
email: "",
kycStatus: KYCSTATUS.PENDING,
});

export const challenge = () => ({
id: "challenge",
ref: "challenge ref",
created_at: new Date("2022-05-01T12:00:00Z"),
updated_at: new Date("2022-05-01T12:00:00Z"),
hint: "Hint",
name: "challenge name",
format: mockFormat,
description: "challenge description",
course: mockCourse,
type: "course",
isTeamChallenge: false,
objectives: ["objectives 1", "Objectives 2", "Objectives 3", "Objectives 4"],
threshold: 8,
community: mockCommunity,
reviewTime: 9,
metadata: metadata,
level: 58,
courses: [mockCourse],
learningModules: [mockLearningModule],
expiresAt: "2025",
reward: reward,
certificateIcon: "certificate",
certificateData: mockCertificateData,
ratingCriteria: [mockRatingCriteria],
timestamp: 6,
maxPoints: 299,
minPoints: 9,
rewards: [reward],
feedbacks: {},
feedbackInfo: [{}],
bestSubmissions: [{}],
teamLimit: 5,
isHackathon: false,
additionalInfo: {
[TEAM_FORMATION]: {
type: "teamFormation",
text: "Form your team details here",
},
},
});

export const submission = (): Submission => ({
length: 0,
id: "submission_id",
ref: "reference",
created_at: new Date("2022-05-01T12:00:00Z"),
updated_at: new Date("2022-05-01T12:00:00Z"),
link: "/submissions/reference",
community: mockCommunity,
user_id: "user_id",
challenge: challenge(),
text: "Submission",
reviewDeadline: new Date(),
metadata: {
evaluation: "",
applicableReward: {
ref: "",
amount: 0,
updated_at: "",
challenge: "",
created_at: "",
id: "",
type: "",
community: "",
timestamp: 0,
token: "",
},
reviewed: false,
feedbacks: 0,
language: "",
},
timestamp: 0,
user: mockUser(),
reviewable: false,
status: "",
reward: reward,
map: function () {
throw new Error("Function not implemented.");
},
});

export const mockInvite = {
created_at: "tuesday",
id: "invite",
ref: "invitation ref",
status: "invitation status",
team_ref: "team reference",
timestamp: 3,
updated_at: "wednesday",
user: mockUser(),
user_id: "user id",
}

export const mockTeamMember: TeamMember = {
created_at: "created_at",
id: "id",
joined_on: "joined_on",
ref: "ref",
team_ref: "team reference",
timestamp: 3,
updated_at: "wednesday",
user: mockUser(),
}

export const mockTeam: Team = {
challenge: challenge(),
challenge_ref: "challenge ref",
created_at: "created at",
id: "id",
locked: true,
name: "Master",
organizer: mockUser(),
organizer_id: "organizer id",
invites: [mockInvite],
members: [mockTeamMember],
ref: "",
timestamp: "",
updated_at: ""
}
57 changes: 57 additions & 0 deletions __mocks__/community.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { Community } from "@/types/community";
import { colors } from "./colors";

export const metadata = {
invite_id: "abc123",
submissions: 5,
bestSubmissions: ["submission1", "submission2"],
feedbacks: 10,
name: "Project XYZ",
issuedOn: "2024-01-29T12:00:00Z",
image: "image_url",
title: "Title of the project",
description: "Description of the project",
narrative: "Narrative of the project",
recipientName: "John Doe",
issuerName: "Jane Smith",
comment: "This is a comment",
linkToWork: "link_to_work",
submission: "submission_details",
};

const reward = {
id: "123456789",
ref: "ref123",
created_at: new Date("2024-01-29T08:00:00Z"),
updated_at: new Date("2024-01-29T08:30:00Z"),
challenge: "Challenge Name",
type: "SUBMISSION",
community: "Community Name",
token: "Token ID",
stable: true,
amount: 100,
timestamp: 1643424000,
};

export const mockCommunity: Community = {
id: "ew-43",
ref: "community/ref",
created_at: new Date("2022-05-01T12:00:00Z"),
updated_at: new Date("2022-05-01T12:00:00Z"),
summary: "this is the summary",
icon: "public/img/communities/aeternity.svg",
name: "aeternity",
image: "public/img/communities/aeternity.svg",
colors: colors,
slug: "ae",
active: true,
description: "this is a aeternity community",
metadata,
timestamp: 182044800000,
rewards: [reward],
reward,
courses: 3,
duration: 4,
can_mint_certificates: true,
challenges: 3,
};
134 changes: 134 additions & 0 deletions __mocks__/course.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import { Course, Format, LearningModule, Material } from "@/types/course";
import { mockTrailer } from "./bounty";


export const Introduction = {
text: "course intro",
};

export const mockCertificateData = {
narrative: "course certificate",
icon: "certificate icon",
};

export const Rubric = {
id: "id",
ref: "rubric references",
created_at: "Wednesday",
updated_at: "Thursday",
challenge: "Challenge",
text: "Challenge text",
type: "challenge type",
order: 89,
points: 90,
timestamp: 73,
typeSlug: "slug",
};

export const mockRatingCriteria = {
name: "rating criteria",
order: 4,
rubric: [Rubric],
maxPoints: 78,
};

enum MaterialType {
ADDITIONAL = "ADDITIONAL",
MARKDOWN = "MARKDOWN",
TEXT = "TEXT",
ARTICLE = "ARTICLE",
"EMBEDDED-VIDEO" = "EMBEDDED-VIDEO",
}
export const mockMaterial: Material = {
duration: 3,
subtitle: "material subtitle",
link: "material link",
description: "material description",
title: "material title",
type: MaterialType.ADDITIONAL,
list: [{ link: "Link 1" }],
};

export const InteractiveModule = {
ref: "interactive module ref",
title: "interactive module title",
text: "interative text",
closing: {
text: "closing",
title: "title",
},
items: [
{
text: "text",
title: "title",
options: {
text: "text",
isCorrect: true,
},
question: {
title: "question title",
answers: ["answer 1", "answer 2"],
correct: 2,
},
},
],
};

export const mockLearningModule: LearningModule = {
id: "learningModule id",
ref: "learning module reference",
created_at: new Date("2022-05-01T12:00:00Z"),
updated_at: new Date("2022-05-01T12:00:00Z"),
duration: 4,
description: "learning module description",
objectives: ["objective 1, objective 2"],
title: "learning module title",
community: "learning module community",
materials: [mockMaterial],
timestamp: 3,
order: 4,
course: "Learning module course",
interactiveModules: [InteractiveModule],
};

export const mockCourse: Course = {
id: "course",
ref: "course ref",
created_at: new Date("2022-05-01T12:00:00Z"),
updated_at: new Date("2022-05-01T12:00:00Z"),
duration: 3,
summary: "Course description",
level: 3,
name: "course name",
description: "Course description",
objectives: ["course description", "course objectives"],
locale: "English",
community: "community",
slug: "course description slug",
introduction: Introduction,
active: true,
certificateIcon: "certificate",
certificateData: mockCertificateData,
timestamp: 0,
learningModules: [mockLearningModule],
trailer: mockTrailer,
disclaimer: "Course",
items: ["item 1", "item 2"],
faq: [
{
description: "faq description",
title: "faq title",
},
],
prerequisite: {
items: ["item 1", "item 2"],
hint: "prerequisite hint",
},
translations: []
};

export const mockFormat: Format = {
githubLink: true,
text: true,
disclaimer: true,
};
7 changes: 4 additions & 3 deletions __mocks__/fixtures/reward.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ export const reward = {
community: "community",
token: "token",
stable: false,
fiatCurrency: "USD",
amount: 10,
timestamp: 10,
distribution: {
first: 1,
second: 2,
third: 3
}
}
third: 3,
},
};
Loading