Bingo for meetings–part 2–working at tests

Bingo is a small project, written in TypeScript , and developed with Alexandru Badita in launch break (one hour - more or less). You can find sources at https://github.com/alexandru360/PresentationBingoCards/ . Those are my blog posts for Bingo : ( scroll below for the post)

NrLink
1Create meeting
2Create Tests
3Finalize Create meeting
4Sharing meeting
5Keep Score
6Add obsolete
7Finalizing obsolete
8End meeting
9Dockerize tests
10Azure CI tests
11Yarn workspaces
12CLI
13Intermezzo - CLI improvements
14typescript compile run with node
15NestJS ,swagger and create a meeting
16Finalizing API
17Intermezzo - jest vs jasmine error
18Refactor WebAPI and test service
19Heroku Deploy NestJs
20Angular
21Deploy Angular to GitHub

(Now the actual blog post for Bingo Meetings project)


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:

  1. 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 )
  2. We solve many errors  ( forgetting put “ export default class “ , “ jest unexpected token import “ ,  jest.config.json  as opposed to jest.config.js
  3. Read jest expect documentation from https://jestjs.io/docs/en/expect.html#not
  4. 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!)