Bingo for meetings–obsolete–part 6

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

(Now the actual blog post for Bingo Meetings project)

The requirement says:

Meeting Obsolete:
The meeting is available for 35 minutes. After that, meeting is not available anymore.

How we can implement this ? Several solutions:

  1. Make the meeting know about this ( and avoiding )
  2. Make a decorator class for this
  3. Make a mixin in TypeScript


I decide to KISS ( ) and take the first point. We implement an Obsolete function. Remains who is responsible of the site to call it.

Now comes other question: When the meeting startsĀ  ?I consider ( for the sake of easy path) that a meeting starts when it is created . So the code is like this

export default class Meeting{

        this.Participants = [];        
        this.Cards = [];
        this.startedMeeting =;
    public static  MaxTime=35 * 60 * 1000;
    // other code here
    public IsObsolete(): boolean{
        return (this.PassedTimeFromStart() > Meeting.MaxTime); //35 minutes
    public PassedTimeFromStart():number{
        let dtNow =;
        return (dtNow - this.startedMeeting );



Now the problem arises when testing code. It is very easy to say that a meeting is not obsolete when just created. However , I do not want to wait for 35minutes + 1 second in order for a meeting to become obsolete and the test to be successful( see
//TODO: wait 35 minutes + 1 second


import  MeetingsFactory from '../MeetingsFactory';
import Meeting from '../meeting';
describe('Meeting Obsolete', () => {
    it('meeting should not be obsolete after creation', () => {
        const mf=new MeetingsFactory();
        const m1=mf.CreateMeeting("andrei","first meeting");
      it('meeting should  be obsolete after 35 minutes', () => {
        const mf=new MeetingsFactory();

        const m1=mf.CreateMeeting("andrei","first meeting");
        //TODO: wait 35 minutes + 1 second

One possible resolution is . However, the problem is so common that here must be include in the test framework ( in this case, jest). And , indeed, it is a way: spyon. So the code is modified accordingly :

it('meeting should  be obsolete after 35 minutes', () => {
        const mf=new MeetingsFactory();

        const m1=mf.CreateMeeting("andrei","first meeting");
        const now =;
        const spy = jest.spyOn(Date,'now');
          console.log('calling DateTime Now');
          return now + 36 * 60* 1000;
        } );

The testing code now assumes that he knows inner working of the code – and the test will fail if we modify the call of
So I think that is far superior.