added testing part

This commit is contained in:
2005 2024-05-23 11:15:29 +02:00
parent 46a84a5168
commit c000b7ce0c

View file

@ -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 # 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. 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 --> [*] 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 # Development
## CI _Continuous Integration_ ## CI _Continuous Integration_