Commit 20e8fa38d214b7d949e68d7a792070b634d6ad08

Authored by Ábner Oliveira
1 parent 00490a95

fixed tests after merge with ngforward branch

src/app/cms/cms.component.ts
@@ -26,8 +26,9 @@ export class Cms { @@ -26,8 +26,9 @@ export class Cms {
26 save() { 26 save() {
27 this.profileService.getCurrentProfile().then((profile: noosfero.Profile) => { 27 this.profileService.getCurrentProfile().then((profile: noosfero.Profile) => {
28 return this.articleService.create(this.article, profile); 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 this.notification.success("Good job!", "Article saved!"); 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,11 +55,11 @@ describe(&#39;Content Viewer Component&#39;, () =&gt; {
55 }); 55 });
56 56
57 it('check if article was loaded', (done: Function) => { 57 it('check if article was loaded', (done: Function) => {
58 - var article: any = { 58 + let article: any = {
59 id: 1, 59 id: 1,
60 title: 'The article test' 60 title: 'The article test'
61 }; 61 };
62 - var profile: any = { 62 + let profile: any = {
63 id: 1, 63 id: 1,
64 identifier: 'the-profile-test', 64 identifier: 'the-profile-test',
65 type: 'Person' 65 type: 'Person'
@@ -71,9 +71,7 @@ describe(&#39;Content Viewer Component&#39;, () =&gt; { @@ -71,9 +71,7 @@ describe(&#39;Content Viewer Component&#39;, () =&gt; {
71 71
72 helpers.mocks.articleService.getByProfile = (id: number, params: any) => { 72 helpers.mocks.articleService.getByProfile = (id: number, params: any) => {
73 return helpers.mocks.promiseResultTemplate({ 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,8 +79,8 @@ describe(&#39;Content Viewer Component&#39;, () =&gt; {
81 buildComponent().then((fixture: ComponentFixture) => { 79 buildComponent().then((fixture: ComponentFixture) => {
82 let contentViewerComp: ContentViewer = fixture.debugElement.componentViewChildren[0].componentInstance; 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 done(); 85 done();
88 }); 86 });