Skip to content

Commit d71d939

Browse files
committed
tests passing
1 parent b736516 commit d71d939

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { routes, switchRoutes } from './routes';
2+
3+
describe('routes spec', () => {
4+
it('"switchRoutes" should have expected value by default', () => {
5+
// Arrange
6+
interface SwitchRoutes {
7+
root: string;
8+
student: string;
9+
trainer: string;
10+
}
11+
12+
const expectedValue: SwitchRoutes = {
13+
root: '/',
14+
student: '/student/:room',
15+
trainer: '/trainer/:room/:token',
16+
};
17+
18+
// Act
19+
20+
// Assert
21+
expect(switchRoutes).toEqual<SwitchRoutes>(expectedValue);
22+
});
23+
24+
it('"routes.student" & "routes.trainer" should be functions by default', () => {
25+
// Arrange
26+
27+
// Act
28+
29+
// Assert
30+
expect(routes.student).toEqual(expect.any(Function));
31+
expect(routes.trainer).toEqual(expect.any(Function));
32+
});
33+
34+
it('"routes.student" should return switchRoutes.student path with room name when called', () => {
35+
// Arrange
36+
const expectedResult: string = '/student/new-room';
37+
38+
// Act
39+
const result: string = routes.student('new-room');
40+
41+
// Assert
42+
expect(result).toEqual(expectedResult);
43+
});
44+
45+
it('"routes.trainer" should return switchRoutes.trainer path with room name when called', () => {
46+
// Arrange
47+
const expectedResult: string = '/trainer/new-room/new-token';
48+
49+
// Act
50+
const result: string = routes.trainer('new-room', 'new-token');
51+
52+
// Assert
53+
expect(result).toEqual(expectedResult);
54+
});
55+
});

0 commit comments

Comments
 (0)