Skip to content

Commit cb8864b

Browse files
committed
chore: fixed merge conflicts
2 parents 30e6670 + d7940e1 commit cb8864b

File tree

5 files changed

+171
-5
lines changed

5 files changed

+171
-5
lines changed

lesson_03/quiz/quiz.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ quiz:
66
anotherone:
77
- $2y$10$8eHSzy3aCu4Ry3LzO9nWCeGpofSxsNVbnF.wCfn3ZADwQ6MEtN/KK
88
- $2y$10$dGB0CGv7.XQC5OqfyY6iXOiJsdVyxU3ve5YE0gt4m2I8P8H13lNXa
9+
meikostephens:
10+
- $2y$10$AD1YHmrZZivus7DoM91UMuErNnpi63ueluFs7DcSQSrZbXwDycAOi
11+
- $2y$10$KvnxAYKh3A151RyOOFtOv.wfImRzZMgbBgKy3gyLd1uUSSjHaN.4u
12+
- $2y$10$qJDpo1X1kFXRD1M6Kpi8WeKg.a8dgzd8RawXX/3RuMqM82biBc6iK
913
khaylasaunders:
1014
- $2y$10$GLR8QrgP55Rjj5Ljf/JgQuyemzq2HzMysMbk6W.m0OkBSJbVHBdxC
1115
- $2y$10$PnjXjW6fUxWSQyFZzy8gDunAxwzHjSHbILe3QW5TRimFeXIqs6tym
@@ -18,7 +22,11 @@ quiz:
1822
- $2y$10$hRwUbEYSqz761B.cG79T2uYsYPiEtKu.JgD3Aj7.Mofx27TtX5YHa
1923
- $2y$10$qE/gXxpq62FEGJOJd9MDA.vpDYLTNSsZbqZLpD/0368CKkcNBzW1y
2024
- $2y$10$yI/2BgOyqQfLdHM3ixPE5uLu89su/sHRJB2c5szDFIAYXDhRakS.C
25+
davidadenaike:
26+
- $2y$10$CCxBimjXsumkjTLWRWqibue0VeGel6Idfb/2q3y.mIuKHbkWVTsx6
27+
- $2y$10$/z0Ri9Fg7pOXUFYsOErj.Ol8Hxcy7zwqWezLTMWVtFv6tzvkCrJti
28+
- $2y$10$vQD1oc2OqiE1PkirdjQ/xu3sbrnJjwImPEwvCmP7Uk0Z1PDqQ0Mq.
2129
rmill:
2230
- $2y$10$FquR69q7W4E68TX/SNCB7u8Ri0DOFRDqsUPdGfuyIBjZJRVFkNI.6
2331
- $2y$10$FSWRA7hulVpyVxd8s67Nxuq/1cdmviW24qqoUbqihBf79cR.w9yly
24-
- $2y$10$Qy1IsNsfuJvA384ypL/72uWubUuNbMRp4LD6j/LM0RIH66D/HIjF6
32+
- $2y$10$Qy1IsNsfuJvA384ypL/72uWubUuNbMRp4LD6j/LM0RIH66D/HIjF6

lesson_03/quiz/src/lesson3.test.ts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { beforeAll, describe, expect, it } from '@jest/globals';
33
import { Test, TestingModule } from '@nestjs/testing';
44
import {
55
AnswerChoice,
6+
MultipleChoiceQuizQuestion,
67
QuizConfig,
78
QuizQuestion,
89
} from 'codedifferently-instructional';
@@ -76,16 +77,42 @@ describe('Lesson3Test', () => {
7677

7778
const maybeIt = process.env.PROVIDER_NAME ? it : it.skip;
7879

80+
maybeIt(
81+
'checks multiple choice answers are configured correctly',
82+
async () => {
83+
for (const [providerName, questions] of quizQuestionsByProvider) {
84+
for (const question of questions) {
85+
if (!(question instanceof MultipleChoiceQuizQuestion)) {
86+
continue;
87+
}
88+
89+
// Assert that multiple choice questions have at least one correct answer.
90+
const choices = question.getAnswerChoices();
91+
const areAnswersValid = await Promise.all(
92+
[...choices].map(async (choice) => {
93+
return quizConfig.checkAnswer(
94+
providerName,
95+
question.getQuestionNumber(),
96+
choice,
97+
);
98+
}),
99+
);
100+
101+
expect(areAnswersValid.some((isCorrect) => isCorrect)).toBe(true);
102+
}
103+
}
104+
},
105+
);
106+
79107
maybeIt('checks for correct answers', async () => {
80-
const targetProviderName =
81-
process.env.PROVIDER_NAME?.toLowerCase().trim() || '';
108+
const targetProviderName = process.env.PROVIDER_NAME?.trim() || '';
82109

83110
if (!quizQuestionsByProvider.has(targetProviderName)) {
84111
throw new Error(`Unknown provider name: ${targetProviderName}`);
85112
}
86113

87114
for (const [providerName, questions] of quizQuestionsByProvider) {
88-
if (providerName !== process.env.PROVIDER_NAME?.toLowerCase().trim()) {
115+
if (providerName !== process.env.PROVIDER_NAME?.trim()) {
89116
continue;
90117
}
91118
for (const question of questions) {
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import {
2+
AnswerChoice,
3+
MultipleChoiceQuizQuestion,
4+
QuizQuestion,
5+
QuizQuestionProvider,
6+
} from 'codedifferently-instructional';
7+
8+
export class DavidAdenaikeQuiz implements QuizQuestionProvider {
9+
getProviderName(): string {
10+
return 'davidadenaike';
11+
}
12+
13+
makeQuizQuestions(): QuizQuestion[] {
14+
return [
15+
DavidAdenaikeQuiz.makeQuestion0(),
16+
DavidAdenaikeQuiz.makeQuestion1(),
17+
DavidAdenaikeQuiz.makeQuestion2(),
18+
];
19+
}
20+
21+
private static makeQuestion0(): QuizQuestion {
22+
return new MultipleChoiceQuizQuestion(
23+
0,
24+
'What does RAM stand for?',
25+
new Map<AnswerChoice, string>([
26+
[AnswerChoice.A, 'Rabbit, Abandon, Machinery'],
27+
[AnswerChoice.B, 'Race, Abbey, Magazine'],
28+
[AnswerChoice.C, 'Racism, Able, Magnetic'],
29+
[AnswerChoice.D, 'Random, Access Memory'],
30+
]),
31+
AnswerChoice.UNANSWERED,
32+
); // Replace `UNANSWERED` with the correct answer.
33+
}
34+
35+
private static makeQuestion1(): QuizQuestion {
36+
return new MultipleChoiceQuizQuestion(
37+
1,
38+
'What does CPU stand for?',
39+
new Map<AnswerChoice, string>([
40+
[AnswerChoice.A, 'Central, Processing, Unit'],
41+
[AnswerChoice.B, 'Cabin, Pace, Umbrella'],
42+
[AnswerChoice.C, 'Cable, Pack, Unanimous'],
43+
[AnswerChoice.D, 'Cage, Pain, Uncle'],
44+
]),
45+
AnswerChoice.UNANSWERED,
46+
); // Replace `UNANSWERED` with the correct answer.
47+
}
48+
49+
private static makeQuestion2(): QuizQuestion {
50+
return new MultipleChoiceQuizQuestion(
51+
2,
52+
'What does GPU stand for?',
53+
new Map<AnswerChoice, string>([
54+
[AnswerChoice.A, 'Galaxy, Palace, Unpleasant'],
55+
[AnswerChoice.B, 'Graphics, Processing, Unit'],
56+
[AnswerChoice.C, 'Gallon, Panic, Unrest'],
57+
[AnswerChoice.D, 'Game, Parachute, Union'],
58+
]),
59+
AnswerChoice.UNANSWERED,
60+
); // Replace `UNANSWERED` with the correct answer.
61+
}
62+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import {
2+
AnswerChoice,
3+
MultipleChoiceQuizQuestion,
4+
QuizQuestion,
5+
QuizQuestionProvider,
6+
} from 'codedifferently-instructional';
7+
8+
export class MeikoStephensQuiz implements QuizQuestionProvider {
9+
getProviderName(): string {
10+
return 'meikostephens';
11+
}
12+
13+
makeQuizQuestions(): QuizQuestion[] {
14+
return [
15+
MeikoStephensQuiz.makeQuestion0(),
16+
MeikoStephensQuiz.makeQuestion1(),
17+
MeikoStephensQuiz.makeQuestion2(),
18+
];
19+
}
20+
21+
private static makeQuestion0(): QuizQuestion {
22+
return new MultipleChoiceQuizQuestion(
23+
0,
24+
'What is a branch?',
25+
new Map<AnswerChoice, string>([
26+
[AnswerChoice.A, 'A new line of code'],
27+
[
28+
AnswerChoice.B,
29+
'A copy of a repository that allows you make changes and merge them later',
30+
],
31+
[AnswerChoice.C, 'A way to delete a respository and start over'],
32+
[AnswerChoice.D, 'A way to run code'],
33+
]),
34+
AnswerChoice.UNANSWERED,
35+
); // Replace `UNANSWERED` with the correct answer.
36+
}
37+
38+
private static makeQuestion1(): QuizQuestion {
39+
return new MultipleChoiceQuizQuestion(
40+
1,
41+
'What does a syncfork do?',
42+
new Map<AnswerChoice, string>([
43+
[AnswerChoice.A, 'Updates changes from the original repository'],
44+
[AnswerChoice.B, 'Deletes the repositiory'],
45+
[AnswerChoice.C, 'Transforms the repository into a branch'],
46+
[AnswerChoice.D, 'Runs the code more efficiently'],
47+
]),
48+
AnswerChoice.UNANSWERED,
49+
); // Replace `UNANSWERED` with the correct answer.
50+
}
51+
52+
private static makeQuestion2(): QuizQuestion {
53+
return new MultipleChoiceQuizQuestion(
54+
2,
55+
'What brings the modify changes to merge into the main repositiory?',
56+
new Map<AnswerChoice, string>([
57+
[AnswerChoice.A, 'A terminal'],
58+
[AnswerChoice.B, 'A branch'],
59+
[AnswerChoice.C, 'A syncfork'],
60+
[AnswerChoice.D, 'A pull request'],
61+
]),
62+
AnswerChoice.UNANSWERED,
63+
); // Replace `UNANSWERED` with the correct answer.
64+
}
65+
}

lesson_03/quiz/src/quizzes/quizzes.module.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { Module } from '@nestjs/common';
22
import { AnotherQuiz } from './another_quiz.js';
33
import { AnthonyMaysQuiz } from './anthony_mays_quiz.js';
4+
import { DavidAdenaikeQuiz } from './david_adenaike_quiz.js';
45
import { Jbeyquiz } from './jbeyquiz.js';
56
import { KhaylaSaundersQuiz } from './khayla_quiz.js';
7+
import { MeikoStephensQuiz } from './meiko_stephens_quiz.js';
68
import { MercedesMathewsQuiz } from './mercedes_mathews_quiz.js';
79
import { RasheedMillerQuiz } from './rasheed_miller_quiz.js';
810

@@ -11,9 +13,11 @@ export const Quizzes = Symbol.for('Quizzes');
1113
// Add your quiz provider here.
1214
const QUIZ_PROVIDERS = [
1315
AnthonyMaysQuiz,
14-
AnotherQuiz,
16+
AnotherQuiz,
17+
MeikoStephensQuiz ,
1518
MercedesMathewsQuiz,
1619
Jbeyquiz,
20+
DavidAdenaikeQuiz,
1721
KhaylaSaundersQuiz,
1822
RasheedMillerQuiz,
1923
];

0 commit comments

Comments
 (0)