Skip to content

Commit

Permalink
finished testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
JayChase committed Jul 5, 2016
1 parent 11e6d7e commit 9552ebc
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 10 deletions.
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,7 @@ ngAfterViewInit() {
this.disqusService.reset('page3', 'http://localhost:3000/demo/page3', true);
}
```

###Future
Add support for comment counts??
https://help.disqus.com/customer/portal/articles/565624-tightening-your-disqus-integration
3 changes: 0 additions & 3 deletions test/demo/demo.component.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/demo/demo.component.spec.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions test/demo/demo.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ import { DisqusService } from '../../src/disqus.service';

class MockDisqusService extends DisqusService {

MockDisqusService() {
spyOn(this,'reset');
}

reset(identifier: string, url: string, reload: boolean): void {

}
Expand Down
2 changes: 1 addition & 1 deletion test/src/disqus-thread.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('disqus-thread component', () => {
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
tcb.createAsync(DisqusThreadComponent)
.then((fixture: ComponentFixture<DisqusThreadComponent>) => {
fixture.detectChanges();
fixture.detectChanges();

expect(fixture).not.toBeNull();
});
Expand Down
26 changes: 26 additions & 0 deletions test/src/disqus.service.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/src/disqus.service.spec.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions test/src/disqus.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import {
async,
beforeEachProviders,
describe,
expect,
inject,
it
} from '@angular/core/testing';

import { DisqusService } from '../../src/disqus.service';

class MockDISQUS {
resetArgs: any;

reset(args: any){
this.resetArgs = args;
}
}

describe('disqus service', () => {
let mockDisqus: MockDISQUS;

beforeEach(()=> {
mockDisqus = new MockDISQUS();

spyOn(mockDisqus,'reset');

(<any>window).DISQUS = mockDisqus;
});

beforeEachProviders(() => [DisqusService])

describe('reset', () => {

it('should call DISQUS.reset', inject([DisqusService], (disqusService: DisqusService) => {
disqusService.reset('id','url',true);

expect(mockDisqus.reset).toHaveBeenCalled();
}));
});

});

0 comments on commit 9552ebc

Please sign in to comment.