O'Reilly logo

Mastering Reactive JavaScript by Erich de Souza Oliveira

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Test implementation

We are going to create three tests for this service: the first checks if the observable returned by this service contains data sent to the given user; the second checks if it contains broadcast messages; and the third checks that it does not contain private messages to other users.

Create a file called listen_to_messages_test.js and paste in the following code to create our test suite:

let assert = require('assert'); let mockDataSourceFactory = require('./mock_datasource_factory'); let servicesFactory = require('../src/services'); describe('Listen to message Test',function(){     it('Must listen to messages sent to me',function(done){         let mockDataSource = mockDataSourceFactory();  let services = servicesFactory(mockDataSource); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required