Comments (5)
I've created a new fork and added the changes there in the main branch.
from quizdown-js.
Hi Malte,
I've created a unit test for the Button component. If you would give me the proper rights, I could push it into a new branch called issue13_add_unit_tests
from quizdown-js.
I used the following tutorial:
https://testing-library.com/docs/svelte-testing-library/intro
I had to add the following packages to the package.json to make the tutorial work:
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/svelte": "^3.0.3",
I also needed to add the following comment at the top of the test file:
/**
- @jest-environment jsdom
*/
Jest-dom is described here:
https://github.com/testing-library/jest-dom#usage
You'll find an overview of testing queries here:
https://testing-library.com/docs/queries/byrole/
from quizdown-js.
For better unit testing I would recommend to break the quiz.ts file into a module which imports all the classes currently included in the quiz.ts file. Like with java, where every class has it's own file.
It will make your code much more readable and force you to give your classes a clear structure and interdependency while preventing your code to become spaghetti ;-)
Also there are a lot of loose functions within the quiz.ts file which mostly seem to be methods that belong to the BaseQuestion class and therefore should be part of it. Quiz just seems to need a bit clean up ;-)
Also I would put each type declaration into its own model file which then should be imported by each class that needs it.
Drawing a UML class diagram could be very helpful for structuring the classes: https://www.tutorialspoint.com/uml/uml_class_diagram.htm
Typescript has a very detailed documentation of how to summarise different classes into one module: https://www.typescriptlang.org/docs/handbook/modules.html
from quizdown-js.
Thanks a lot, Kristian, for your work and suggestions. I will look into it in the upcoming weeks.
from quizdown-js.
Related Issues (20)
- Option to define the displayed number of questions HOT 1
- Fill in the blanks quiz HOT 4
- results summary page for a quiz consisting of many sub quizzes HOT 1
- Additional blank lines break the quiz
- Activate / focus block with choices automatically HOT 2
- Installation issues HOT 1
- Layout bug in Internet Explorer HOT 1
- Implement quizdown into docsify
- Option to highlight correct answer after the end of quiz HOT 1
- Keyboard navigation on results page HOT 2
- Reopen #22
- Tab key navigation on first quiz page broken HOT 6
- Key navigation in Safari not available HOT 1
- required answer HOT 1
- save quiz results HOT 3
- Deobfuscation HOT 1
- Start the quiz on button click HOT 2
- Final score? HOT 2
- Pass / Fail option and custom message on results HOT 1
- Fill in the blank or Free response?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quizdown-js.