So now because we have created the objects and a function to create meetings,we do create some tests. We decided to work with JEST.
Steps:
- We read many tutorials (https://medium.com/@mtiller/debugging-with-typescript-jest-ts-jest-and-visual-studio-code-ef9ca8644132,https://rjzaworski.com/2016/12/testing-typescript-with-jest,https://github.com/facebook/jest/tree/master/examples/typescript,https://amenallah.com/node-js-typescript-jest-starter/,https://basarat.gitbooks.io/typescript/docs/testing/jest.html,https://dev.to/muhajirdev/unit-testing-with-typescript-and-jest-2gln )
 - We solve many errors ( forgetting put “ export default class “,“ jest unexpected token import “,jest.config.json as opposed to jest.config.js
 - Read jest expect documentation from https://jestjs.io/docs/en/expect.html#not
 - We finally wrote 2 tests in order to verify meeting creation and run with npm test
 
import MeetingsFactory from '../MeetingsFactory';
import Meeting from '../meeting';
describe('Meetings creation',() => {
it('a meeting should have been created properly',() => {
const mf=new MeetingsFactory();
const m1=mf.CreateMeeting("andrei","first meeting");
expect(m1.Name).toBe("first meeting");
expect(m1.Participants.length).toBe(1);
expect(m1.Participants[0].Name).toBe("andrei");
})
it('two meeting have different ids',() => {
const mf=new MeetingsFactory();
const m1=mf.CreateMeeting("andrei","first meeting");
const m2=mf.CreateMeeting("andrei","first meeting");
expect(m1.Id).not.toBe(m2.Id);
})
})
And with this we just verify first use case
Create Meeting Bingo:
As a user,I want to create a new meeting bingo: I use an username and meeting name and the application generates an unique Id that I can access the bingo cards ( state : not checked) for that meeting
And not even the whole( we do not have the cards,not the state for the cards!)
Leave a Reply