Commit 811f695cb5b5a460c5e2e76e10b9c8db4a09ea61
1 parent
edcd0442
Exists in
master
and in
15 other branches
fixed errors on allow-comment component specs
Showing
3 changed files
with
43 additions
and
16 deletions
Show diff stats
src/app/article/comment/comments.component.spec.ts
| ... | ... | @@ -19,7 +19,6 @@ describe("Components", () => { |
| 19 | 19 | |
| 20 | 20 | let properties = { article: { id: 1 }, parent: <any>null }; |
| 21 | 21 | function createComponent() { |
| 22 | - // postCommentEventService = jasmine.createSpyObj("postCommentEventService", ["subscribe"]); | |
| 23 | 22 | let providers = [ |
| 24 | 23 | helpers.createProviderToValue('CommentService', commentService), |
| 25 | 24 | helpers.createProviderToValue('NotificationService', helpers.mocks.notificationService), | ... | ... |
src/plugins/comment_paragraph/allow-comment/allow-comment.component.spec.ts
| ... | ... | @@ -3,7 +3,6 @@ import {ComponentTestHelper, createClass} from '../../../spec/component-test-hel |
| 3 | 3 | import * as helpers from "../../../spec/helpers"; |
| 4 | 4 | import {Provider} from 'ng-forward'; |
| 5 | 5 | import {ComponentFixture} from 'ng-forward/cjs/testing/test-component-builder'; |
| 6 | - | |
| 7 | 6 | let htmlTemplate = '<comment-paragraph-plugin-allow-comment [content]="ctrl.content" [paragraph-uuid]="ctrl.paragraphUuid" [article]="ctrl.article"></comment-paragraph-plugin-allow-comment>'; |
| 8 | 7 | |
| 9 | 8 | describe("Components", () => { |
| ... | ... | @@ -23,6 +22,7 @@ describe("Components", () => { |
| 23 | 22 | }; |
| 24 | 23 | |
| 25 | 24 | let providers = [ |
| 25 | + new Provider('CommentService', { useValue: helpers.mocks.commentService } ), | |
| 26 | 26 | new Provider('CommentParagraphService', { useValue: serviceMock }), |
| 27 | 27 | new Provider('CommentParagraphEventService', { useValue: eventServiceMock }) |
| 28 | 28 | ]; | ... | ... |
src/spec/mocks.ts
| ... | ... | @@ -85,24 +85,24 @@ export var mocks: any = { |
| 85 | 85 | mocks.articleService.articleAddedFn = fn; |
| 86 | 86 | }, |
| 87 | 87 | modelRemovedEventEmitter: |
| 88 | - { | |
| 89 | - subscribe: (fn: Function) => { | |
| 90 | - mocks.articleService.articleRemovedFn = fn; | |
| 91 | - }, | |
| 92 | - next: (param: any) => { | |
| 93 | - mocks.articleService.articleRemovedFn(param); | |
| 94 | - } | |
| 88 | + { | |
| 89 | + subscribe: (fn: Function) => { | |
| 90 | + mocks.articleService.articleRemovedFn = fn; | |
| 91 | + }, | |
| 92 | + next: (param: any) => { | |
| 93 | + mocks.articleService.articleRemovedFn(param); | |
| 95 | 94 | } |
| 95 | + } | |
| 96 | 96 | , |
| 97 | 97 | modelAddedEventEmitter: |
| 98 | - { | |
| 99 | - subscribe: (fn: Function) => { | |
| 100 | - mocks.articleService.articleAddedFn = fn; | |
| 101 | - }, | |
| 102 | - next: (param: any) => { | |
| 103 | - mocks.articleService.articleAddedFn(param); | |
| 104 | - } | |
| 98 | + { | |
| 99 | + subscribe: (fn: Function) => { | |
| 100 | + mocks.articleService.articleAddedFn = fn; | |
| 101 | + }, | |
| 102 | + next: (param: any) => { | |
| 103 | + mocks.articleService.articleAddedFn(param); | |
| 105 | 104 | } |
| 105 | + } | |
| 106 | 106 | , |
| 107 | 107 | remove: (article: noosfero.Article) => { |
| 108 | 108 | return { |
| ... | ... | @@ -156,6 +156,34 @@ export var mocks: any = { |
| 156 | 156 | instant: () => { } |
| 157 | 157 | }, |
| 158 | 158 | commentService: { |
| 159 | + commentRemovedFn: null, | |
| 160 | + commentAddedFn: null, | |
| 161 | + subscribeToModelRemoved: (fn: Function) => { | |
| 162 | + mocks.commentService.commentRemovedFn = fn; | |
| 163 | + }, | |
| 164 | + subscribeToModelAdded: (fn: Function) => { | |
| 165 | + mocks.commentService.commentAddedFn = fn; | |
| 166 | + }, | |
| 167 | + modelRemovedEventEmitter: | |
| 168 | + { | |
| 169 | + subscribe: (fn: Function) => { | |
| 170 | + mocks.commentService.commentRemovedFn = fn; | |
| 171 | + }, | |
| 172 | + next: (param: any) => { | |
| 173 | + mocks.commentService.commentRemovedFn(param); | |
| 174 | + } | |
| 175 | + } | |
| 176 | + , | |
| 177 | + modelAddedEventEmitter: | |
| 178 | + { | |
| 179 | + subscribe: (fn: Function) => { | |
| 180 | + mocks.articleService.commentAddedFn = fn; | |
| 181 | + }, | |
| 182 | + next: (param: any) => { | |
| 183 | + mocks.articleService.commentAddedFn(param); | |
| 184 | + } | |
| 185 | + } | |
| 186 | + , | |
| 159 | 187 | getByArticle: (article: noosfero.Article) => { |
| 160 | 188 | return Promise.resolve({ data: {} }); |
| 161 | 189 | } | ... | ... |