Commit 20e8fa38d214b7d949e68d7a792070b634d6ad08

Authored by Ábner Oliveira
1 parent 00490a95
Exists in master and in 1 other branch dev-fixes

fixed tests after merge with ngforward branch

src/app/cms/cms.component.ts
... ... @@ -26,8 +26,9 @@ export class Cms {
26 26 save() {
27 27 this.profileService.getCurrentProfile().then((profile: noosfero.Profile) => {
28 28 return this.articleService.create(this.article, profile);
29   - }).then((response: restangular.IResponse) => {
30   - this.$state.transitionTo('main.profile.page', { page: response.data.article.path, profile: response.data.article.profile.identifier });
  29 + }).then((response: noosfero.RestResult<noosfero.Article>) => {
  30 + let article = (<noosfero.Article>response.data);
  31 + this.$state.transitionTo('main.profile.page', { page: article.path, profile: article.profile.identifier });
31 32 this.notification.success("Good job!", "Article saved!");
32 33 });
33 34 }
... ...
src/app/content-viewer/content-viewer.component.spec.ts
... ... @@ -55,11 +55,11 @@ describe(&#39;Content Viewer Component&#39;, () =&gt; {
55 55 });
56 56  
57 57 it('check if article was loaded', (done: Function) => {
58   - var article: any = {
  58 + let article: any = {
59 59 id: 1,
60 60 title: 'The article test'
61 61 };
62   - var profile: any = {
  62 + let profile: any = {
63 63 id: 1,
64 64 identifier: 'the-profile-test',
65 65 type: 'Person'
... ... @@ -71,9 +71,7 @@ describe(&#39;Content Viewer Component&#39;, () =&gt; {
71 71  
72 72 helpers.mocks.articleService.getByProfile = (id: number, params: any) => {
73 73 return helpers.mocks.promiseResultTemplate({
74   - data: {
75   - article: article
76   - }
  74 + data: article
77 75 });
78 76 };
79 77  
... ... @@ -81,8 +79,8 @@ describe(&#39;Content Viewer Component&#39;, () =&gt; {
81 79 buildComponent().then((fixture: ComponentFixture) => {
82 80 let contentViewerComp: ContentViewer = fixture.debugElement.componentViewChildren[0].componentInstance;
83 81  
84   - expect(contentViewerComp.profile).toEqual(jasmine.objectContaining(profile));
85   - expect(contentViewerComp.article).toEqual(jasmine.objectContaining(article));
  82 + expect(contentViewerComp.profile).toEqual(profile);
  83 + expect(contentViewerComp.article).toEqual(article);
86 84  
87 85 done();
88 86 });
... ...