-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add test for the section challenge #1245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Samantha-KY
wants to merge
15
commits into
dev
Choose a base branch
from
test/section-challenge-testing
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5cd79af
feat: add test for the section challenge
Samantha-KY 60e2c68
fix: dev merge conflicts
Samantha-KY 4497816
feat: add test for the rubric rating component
Samantha-KY af05de7
feat: add team challenge test
Samantha-KY 74f4e3d
feat: implement coderabbit review
Samantha-KY 2738796
feat: format files
Samantha-KY f244726
feat: implement coderabbit review
Samantha-KY da463de
feat: mock the state object
Samantha-KY 04991ec
feat: add missing test and refactor style changes
Samantha-KY 089b0f2
feat: merge with dev
Samantha-KY d67f9c6
fix: submission test error
Samantha-KY e9f58b3
refactor: remove unused mock
Samantha-KY 2f35e1b
feat: implement reviews
Samantha-KY f923607
fix: merge conflicts
Samantha-KY 4246476
feat: set the testId with a default string
Samantha-KY File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,10 @@ | ||
export const mockTrailer = { | ||
summary: "trailer summary", | ||
description: "trailer description", | ||
video: "trailer video", | ||
duration: 4, | ||
info: { | ||
items: ["item 1", "item 2"], | ||
title: "info title", | ||
}, | ||
}; |
This file contains hidden or 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,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: "" | ||
} |
This file contains hidden or 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,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, | ||
}; |
This file contains hidden or 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,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, | ||
}; |
This file contains hidden or 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,37 @@ | ||
import { Referral, UserReferral } from "@/types/community"; | ||
import { mockCommunity } from "./community"; | ||
import { challenge, mockUser, submission as getMockSubmission } from "./challenge"; | ||
|
||
|
||
const referralSubmission = () => Object.assign(getMockSubmission(), { challengeData: challenge(), link: "referral-link" }); | ||
const userReferral: UserReferral = Object.assign(mockUser(), { submissions: [referralSubmission()] }); | ||
|
||
export const mockReferral = (): Referral => ({ | ||
id: "", | ||
name: "", | ||
ref: "", | ||
created_at: new Date("2022-05-01T12:00:00Z"), | ||
updated_at: new Date("2022-05-01T12:00:00Z"), | ||
title: "", | ||
community: mockCommunity, | ||
timestamp: 0, | ||
reward: { | ||
id: "", | ||
ref: "", | ||
created_at: new Date("2022-05-01T12:00:00Z"), | ||
updated_at: new Date("2022-05-01T12:00:00Z"), | ||
challenge: "", | ||
type: "", | ||
community: "", | ||
token: "", | ||
stable: false, | ||
fiatCurrency: undefined, | ||
amount: 0, | ||
timestamp: 0, | ||
distribution: undefined, | ||
}, | ||
challenge: challenge(), | ||
submissions: [getMockSubmission()], | ||
rewarded: false, | ||
user: userReferral, | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.