Bingo for meetings–working at score-part 5


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 . Those are my blog posts for Bingo : ( scroll below for the post)
1Create meeting
2Create Tests
3Finalize Create meeting
4Sharing meeting
5Keep Score
6Add obsolete
7Finalizing obsolete
8End meeting
9Dockerize tests
10Azure CI tests
11Yarn workspaces
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
21Deploy Angular to GitHub
22WebAPI and Web
24Documentation of the code

The next requirement is saying ( )

Checking cards:
A total score will be displayed when checking / unchecking

There are 2 things very clear:

  1. The name of the user story is not reflecting the content
  2. It should not be just the total score, but also should be the percentage of the bingo cards checked from the total number of cards. It is not so difficult to have the total number of cards, so let’s add this.


We have put this code:


public TotalNumberOfCardsChecked():number{
        return this.Cards.filter(it=>it.IsChecked()).length ;


And we put test

it('number of cards checked', () => {
        const mf=new MeetingsFactory();
        const m1=mf.CreateMeeting("andrei","first meeting");
        m1.CheckCardByParticipant(m1.Cards[0], m1.Participants[0]);    


We see that for TotalNumberOfCardsChecked and AllUnchecked we have the same code

public AllUnchecked(): boolean{
        return (this.Cards.filter(it=>it.IsChecked()).length === 0);
    //other code
public TotalNumberOfCardsChecked():number{
        return this.Cards.filter(it=>it.IsChecked()).length ;

and because we hate copy paste we refactor and re-test

So we refactor a bit .

public AllUnchecked(): boolean{
        return (this.TotalNumberOfCardsChecked() === 0);

And because we have tests, that means we are pretty confident of what are we doing

Also, we said that we have to calculate the total number of checked cards. This is not so difficult, and it alleviates the Law of Dots /Demeter (

public TotalNumberOfCards():number{
        return this.Cards.length;

The consequence ? To maintain code coverage, we should add another line of test:


Also, because the requirement says to display, and we are not yet to the GUI, I have put a new note that says

– [ ] display total number of cards checked or percentage ( use TotalNumberOfCardsChecked and/or TotalNumberOfCards)