Skip to content

Commit 8378adb

Browse files
authored
Merge pull request #40 from yaseerokino/test
Add test for reservations counter function
2 parents faaccc9 + f44b435 commit 8378adb

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ npm test
100100
- Twitter: [@Kossi-stack](https://twitter.com/SoloJean5)
101101
- LinkedIn: [Kossi Stack](https://www.linkedin.com/in/kossifioklou2406/)
102102

103+
103104
### Lilian Moraa
104105

105-
- GitHub: [@yaseerokino](https://github.com/yaseerokino)
106-
- Twitter: [@yaseerokino](https://twitter.com/yaseerokino)
107-
- LinkedIn: [Yaseer Okino](https://linkedin.com/in/yaseerokino)
106+
- GitHub: [@lily-coder](https://github.com/lily-coder/)
107+
- LinkedIn: [Lilian Moraa](https://www.linkedin.com/in/lilian-moraa-99950b1b8/)
108108

109109
## 👊🏾 Show your support
110110

dist/main.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/modules/test/counter.test.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,42 @@ describe('Comments Counter function Test', () => {
7171
expect(commentLength).toBe(4);
7272
});
7373
});
74+
75+
describe('Test for Reservations Counter function', () => {
76+
const reserveArray = [
77+
];
78+
test('should return reservations array length of 0', () => {
79+
const reserveLength = counter.meals(reserveArray);
80+
expect(reserveLength).toBe(0);
81+
});
82+
test('should return meals array length of 2 ', () => {
83+
reserveArray.push(
84+
{
85+
mealID: 1,
86+
reserveName: 'Lilian',
87+
reserveStartDate: '2021-02-01',
88+
reserveEndDate: '2021-02-02',
89+
},
90+
{
91+
mealID: 2,
92+
reserveName: 'Yvonne',
93+
reserveStartDate: '2021-02-03',
94+
reserveEndDate: '2021-02-04',
95+
},
96+
);
97+
const reserveLength = counter.meals(reserveArray);
98+
expect(reserveLength).toBe(2);
99+
});
100+
test('should return meals array length of 3 ', () => {
101+
reserveArray.push(
102+
{
103+
mealID: 3,
104+
reserveName: 'Moraa',
105+
reserveStartDate: '2021-02-14',
106+
reserveEndDate: '2021-02-15',
107+
},
108+
);
109+
const reserveLength = counter.meals(reserveArray);
110+
expect(reserveLength).toBe(3);
111+
});
112+
});

0 commit comments

Comments
 (0)