Skip to content

Commit a25643e

Browse files
committed
Fix tsconfig build include path so quiz compiles
1 parent f9061ec commit a25643e

File tree

8 files changed

+85
-12
lines changed

8 files changed

+85
-12
lines changed

lesson_03/quiz/package-lock.json

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lesson_03/quiz/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
"dependencies": {
4040
"@nestjs/common": "^10.4.15",
4141
"@nestjs/core": "^10.4.15",
42+
"bcrypt": "^6.0.0",
4243
"codedifferently-instructional": "file:../../lib/javascript/codedifferently-instructional",
4344
"reflect-metadata": "^0.2.2",
4445
"rxjs": "^7.8.1"
4546
}
46-
}
47+
}

lesson_03/quiz/quiz.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ quiz:
1010
- $2y$10$FMRsdjEhIG0anbZOIcVvSOy4e4eFTZGIYYyATChwc.QRMpWuomR5C
1111
- $2y$10$0AQW/94c4pPxp8xIhJUIs.qoLnUuQg/Hwe1vd4975K96EKGEPz.H6
1212
- $2y$10$ibNpd6ZjWh/yRXafaN8R5.vxbBw7KVZ7r4IsFv4Uy3naXqagr2B5W
13+
tobiasevans:
14+
- $2b$10$ta73QpJyckVs8ycMG3SXmuy44q.ZxmCMoqzvCd6jIojaykqzxbQOm
15+
- $2b$10$NB928Rk3CGBERrOFfzFuWeJca9xs2DKfljmOm2nvkcZZfEu7C00Iu
16+
- $2b$10$vU9Fk0AiaA/B0r2ur0XyT.sYefBQDBoTdDmp6dkRKSuRjQtCWyuIu
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* global console */
2+
3+
import bcrypt from 'bcrypt';
4+
5+
const answers = ['B', 'B', 'C']; // Correct answers
6+
const saltRounds = 10;
7+
8+
answers.forEach((answer) => {
9+
const hash = bcrypt.hashSync(answer, saltRounds);
10+
console.log(`Answer: ${answer}${hash}`);
11+
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import { Module } from '@nestjs/common';
22
import { AnotherQuiz } from './another_quiz.js';
33
import { AnthonyMaysQuiz } from './anthony_mays_quiz.js';
44
import { BrooklynHardenQuiz } from './brooklyn_harden_quiz.js';
5-
import { TobaisEvansQuiz } from './tobais_evans_quiz.js';
5+
import { TobiasEvansQuiz } from './tobias_evans_quiz.js';
66

77
export const Quizzes = Symbol.for('Quizzes');
88

99
const QUIZ_PROVIDERS = [
1010
AnthonyMaysQuiz,
1111
AnotherQuiz,
1212
BrooklynHardenQuiz,
13-
TobaisEvansQuiz,
13+
TobiasEvansQuiz,
1414
];
1515

1616
@Module({

lesson_03/quiz/src/quizzes/tobais_evans_quiz.ts renamed to lesson_03/quiz/src/quizzes/tobias_evans_quiz.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import {
55
QuizQuestionProvider,
66
} from 'codedifferently-instructional';
77

8-
export class TobaisEvansQuiz implements QuizQuestionProvider {
8+
export class TobiasEvansQuiz implements QuizQuestionProvider {
99
getProviderName(): string {
10-
return 'tobaisevans';
10+
return 'tobiasevans';
1111
}
1212

1313
makeQuizQuestions(): QuizQuestion[] {
1414
return [
15-
TobaisEvansQuiz.makeQuestion0(),
16-
TobaisEvansQuiz.makeQuestion1(),
17-
TobaisEvansQuiz.makeQuestion2(),
15+
TobiasEvansQuiz.makeQuestion0(),
16+
TobiasEvansQuiz.makeQuestion1(),
17+
TobiasEvansQuiz.makeQuestion2(),
1818
];
1919
}
2020

@@ -28,7 +28,7 @@ export class TobaisEvansQuiz implements QuizQuestionProvider {
2828
[AnswerChoice.C, 'C++'],
2929
[AnswerChoice.D, 'Java'],
3030
]),
31-
AnswerChoice.UNANSWERED, // Replace with correct answer later
31+
AnswerChoice.B, // correct answer
3232
);
3333
}
3434

@@ -42,7 +42,7 @@ export class TobaisEvansQuiz implements QuizQuestionProvider {
4242
[AnswerChoice.C, 'Create a new branch'],
4343
[AnswerChoice.D, 'Send changes to the internet'],
4444
]),
45-
AnswerChoice.UNANSWERED, // Replace with correct answer later
45+
AnswerChoice.B, // correct answer
4646
);
4747
}
4848

@@ -56,7 +56,7 @@ export class TobaisEvansQuiz implements QuizQuestionProvider {
5656
[AnswerChoice.C, '<h1>'],
5757
[AnswerChoice.D, '<title>'],
5858
]),
59-
AnswerChoice.UNANSWERED, // Replace with correct answer later
59+
AnswerChoice.C, // correct answer
6060
);
6161
}
6262
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import bcrypt from 'bcrypt';
2+
3+
const answers = [
4+
{
5+
letter: 'B',
6+
hash: '$2b$10$ta73QpJyckVs8ycMG3SXmuy44q.ZxmCMoqzvCd6jIojaykqzxbQOm',
7+
},
8+
{
9+
letter: 'B',
10+
hash: '$2b$10$NB928Rk3CGBERrOFfzFuWeJca9xs2DKfljmOm2nvkcZZfEu7C00Iu',
11+
},
12+
{
13+
letter: 'C',
14+
hash: '$2b$10$vU9Fk0AiaA/B0r2ur0XyT.sYefBQDBoTdDmp6dkRKSuRjQtCWyuIu',
15+
},
16+
];
17+
18+
answers.forEach((a, i) => {
19+
const match = bcrypt.compareSync(a.letter, a.hash);
20+
console.log(`Question ${i}: ${match ? '✅ matches' : '❌ does not match'}`);
21+
});

lesson_03/quiz/tsconfig.build.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"extends": "./tsconfig",
3-
"exclude": ["node_modules", "build", "**/*.test.ts"]
3+
"exclude": ["node_modules", "build", "**/*.test.ts"],
4+
"include": ["src/**/*"]
45
}

0 commit comments

Comments
 (0)