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_