From c000b7ce0ca88ca61c1780149b2a64f37c787e13 Mon Sep 17 00:00:00 2001 From: 4o1x5 <4o1x5@4o1x5.dev> Date: Thu, 23 May 2024 11:15:29 +0200 Subject: [PATCH] added testing part --- readme.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/readme.md b/readme.md index 0507884..a31699e 100644 --- a/readme.md +++ b/readme.md @@ -220,6 +220,21 @@ public Image getImage(URL url, String name) { } ``` +## Testing + +Junit will be used to perform tests as it is the most popular testing frameworks for java. + +```java +public class UserServiceTests { + + @Test + public void TestUserPermissions() { + User user = new User(); + // testing done here + } +} +``` + # Frontend Documenting the frontend is quite hard, but since there will be state management and complicated classes for managing data it has to be all written down. @@ -268,6 +283,31 @@ stateDiagram-v2 Crash --> [*] ``` +## Testing + +For testing typescript classes and it's methods [Jest](https://jestjs.io/docs/getting-started) (jestjs) will be used. + +Example: + +1. Define the test in `tests/test.ts` + +```typescript +// tests/testClass.ts +function sum(a, b) { + a + b; +} + +test("adds 1 + 2 to equal 3", () => { + expect(sum(1, 2)).toBe(3); +}); +``` + +2. Run test + +```bash +npm test +``` + # Development ## CI _Continuous Integration_