Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
fix(tests): adds broadcaster test
Browse files Browse the repository at this point in the history
  • Loading branch information
dgutride authored and joshuawilson committed Apr 1, 2017
1 parent 3d61018 commit 4d1ec85
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ module.exports = function(config) {
},
},
flags: ['--load-images=true'],
debug: true
debug: false
}
},
phantomjsLauncher: {
Expand Down
33 changes: 30 additions & 3 deletions src/app/broadcaster.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
describe('Broadcaster service', () => {
it ('should test the Broadcaster service', function () {
expect(1).toBe(1);
import { inject, TestBed } from '@angular/core/testing';
import { Broadcaster } from './broadcaster.service';

describe('Service: Broadcaster service', () => {

let broadcaster: Broadcaster;

beforeEach(() => {
TestBed.configureTestingModule({
providers: [
Broadcaster
]
});
});

beforeEach(inject(
[Broadcaster],
(broadcast: Broadcaster) => {
broadcaster = broadcast;
}
));

it('Broadcaster can successfully send and receive messages', (done) => {
broadcaster.on('testEvent').subscribe((data: number) => {
expect(data).toEqual(1001);
done();
});

broadcaster.broadcast('testEvent', 1001);
});
});

0 comments on commit 4d1ec85

Please sign in to comment.