From 3296e9730f178b7e03fb2cae16819f9dbdc87b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Agneray?= <francois.agneray@lam.fr> Date: Fri, 30 Sep 2022 18:48:11 +0200 Subject: [PATCH] Fixed tests webpage module --- .../components/webpage-family-card.component.spec.ts | 6 +++--- .../webpage/components/webpage-form.component.spec.ts | 5 +++-- .../webpage/containers/edit-webpage.component.spec.ts | 2 +- .../webpage/containers/new-webpage.component.spec.ts | 2 +- .../webpage/containers/webpage-list.component.spec.ts | 2 +- .../instance/webpage/edit-webpage-title.resolver.spec.ts | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/client/src/app/admin/instance/webpage/components/webpage-family-card.component.spec.ts b/client/src/app/admin/instance/webpage/components/webpage-family-card.component.spec.ts index 69ca25a3..f69092a0 100644 --- a/client/src/app/admin/instance/webpage/components/webpage-family-card.component.spec.ts +++ b/client/src/app/admin/instance/webpage/components/webpage-family-card.component.spec.ts @@ -65,9 +65,9 @@ describe('[admin][instance][webpage][components] WebpageFamilyCardComponent ', ( component = fixture.componentInstance; component.webpageFamily = { display: 10, icon: 'test', id: 0, label: 'webpageFamilly test label' }; component.webpageList = [ - { icon: 'test1', content: 'test1', display: 10, id: 0, id_webpage_family: 0, label: 'test1', title: 'test-title1' }, - { icon: 'test2', content: 'test2', display: 10, id: 0, id_webpage_family: 0, label: 'test2', title: 'test-title2' }, - { icon: 'test3', content: 'test3', display: 10, id: 0, id_webpage_family: 1, label: 'test3', title: 'test-title3' } + { icon: 'test1', content: 'test1', display: 10, id: 0, id_webpage_family: 0, label: 'test1', title: 'test-title1', name: 'test1', style_sheet: '' }, + { icon: 'test2', content: 'test2', display: 10, id: 0, id_webpage_family: 0, label: 'test2', title: 'test-title2', name: 'test2', style_sheet: '' }, + { icon: 'test3', content: 'test3', display: 10, id: 0, id_webpage_family: 1, label: 'test3', title: 'test-title3', name: 'test3', style_sheet: '' } ]; fixture.detectChanges(); }); diff --git a/client/src/app/admin/instance/webpage/components/webpage-form.component.spec.ts b/client/src/app/admin/instance/webpage/components/webpage-form.component.spec.ts index f170e45a..a37554bb 100644 --- a/client/src/app/admin/instance/webpage/components/webpage-form.component.spec.ts +++ b/client/src/app/admin/instance/webpage/components/webpage-form.component.spec.ts @@ -23,14 +23,16 @@ describe('[admin][instance][webpage][components]WebpageFormComponent ', () => { let fixture: ComponentFixture<WebpageFormComponent>; let spy; let form = new UntypedFormGroup({ + name: new UntypedFormControl('', [Validators.required]), label: new UntypedFormControl('', [Validators.required]), icon: new UntypedFormControl(null), display: new UntypedFormControl('', [Validators.required]), title: new UntypedFormControl('', [Validators.required]), content: new UntypedFormControl('', [Validators.required]), + style_sheet: new UntypedFormControl(null), id_webpage_family: new UntypedFormControl('', [Validators.required]) }); - let webpage: Webpage = { icon: '', content: '', display: 10, id: 0, id_webpage_family: 0, label: '', title: '' }; + let webpage: Webpage = { icon: '', content: '', display: 10, id: 0, id_webpage_family: 0, label: '', title: '', name: '', style_sheet: '' }; beforeEach(() => { TestBed.configureTestingModule({ @@ -60,7 +62,6 @@ describe('[admin][instance][webpage][components]WebpageFormComponent ', () => { component.submit(); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith({ ...component.webpage, ...component.form.getRawValue() }); - }) it('should emit with webpage only', () => { diff --git a/client/src/app/admin/instance/webpage/containers/edit-webpage.component.spec.ts b/client/src/app/admin/instance/webpage/containers/edit-webpage.component.spec.ts index 257f6a6a..fe59080f 100644 --- a/client/src/app/admin/instance/webpage/containers/edit-webpage.component.spec.ts +++ b/client/src/app/admin/instance/webpage/containers/edit-webpage.component.spec.ts @@ -48,7 +48,7 @@ describe('[admin][instance][webpage][containers] EditWebpageComponent ', () => { }); it('dispatch webpageActions.editWebPage with the new webpage values', () => { - let webpage: Webpage = { icon: '', content: '', display: 10, id: 0, id_webpage_family: 0, label: '', title: '' }; + let webpage: Webpage = { icon: '', content: '', display: 10, id: 0, id_webpage_family: 0, label: '', title: '', name: '', style_sheet: '' }; component.editWebpage(webpage); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(webpageActions.editWebpage({ webpage })); diff --git a/client/src/app/admin/instance/webpage/containers/new-webpage.component.spec.ts b/client/src/app/admin/instance/webpage/containers/new-webpage.component.spec.ts index 44278efd..3fd5c4d7 100644 --- a/client/src/app/admin/instance/webpage/containers/new-webpage.component.spec.ts +++ b/client/src/app/admin/instance/webpage/containers/new-webpage.component.spec.ts @@ -56,7 +56,7 @@ describe('[admin][instance][webpage][containers] NewWebpageComponent ', () => { }); it('dispatch webpageActions.addWebPage with the new webpage values', () => { - let webpage: Webpage = { icon: '', content: '', display: 10, id: 0, id_webpage_family: 0, label: '', title: '' }; + let webpage: Webpage = { icon: '', content: '', display: 10, id: 0, id_webpage_family: 0, label: '', title: '', name: '', style_sheet: '' }; component.addNewWebpage(webpage); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(webpageActions.addWebpage({ webpage })); diff --git a/client/src/app/admin/instance/webpage/containers/webpage-list.component.spec.ts b/client/src/app/admin/instance/webpage/containers/webpage-list.component.spec.ts index 2fa3c696..4263e34d 100644 --- a/client/src/app/admin/instance/webpage/containers/webpage-list.component.spec.ts +++ b/client/src/app/admin/instance/webpage/containers/webpage-list.component.spec.ts @@ -88,7 +88,7 @@ describe('[admin][instance][webpage][containers] WebpageListComponent ', () => { }); it('dispatch webpageFamilyActions.deleteWebpage', () => { - let webpage: Webpage = { icon: '', content: '', display: 10, id: 0, id_webpage_family: 0, label: '', title: '' }; + let webpage: Webpage = { icon: '', content: '', display: 10, id: 0, id_webpage_family: 0, label: '', title: '', name: '', style_sheet: '' }; component.deleteWebpage(webpage); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(webpageActions.deleteWebpage({webpage})); diff --git a/client/src/app/admin/instance/webpage/edit-webpage-title.resolver.spec.ts b/client/src/app/admin/instance/webpage/edit-webpage-title.resolver.spec.ts index 7db89ec7..50352943 100644 --- a/client/src/app/admin/instance/webpage/edit-webpage-title.resolver.spec.ts +++ b/client/src/app/admin/instance/webpage/edit-webpage-title.resolver.spec.ts @@ -32,7 +32,7 @@ describe('[Webpage] EditWebpageTitleResolver', () => { provideMockStore({}), ] }) - let webpage: Webpage = { icon: '', content: '', display: 10, id: 0, id_webpage_family: 0, label: 'webpage_test_label', title: '' }; + let webpage: Webpage = { icon: '', content: '', display: 10, id: 0, id_webpage_family: 0, label: 'webpage_test_label', title: '', name: '', style_sheet: '' }; let instance: Instance; instance = { ...instance, label: 'instance_test_label' } -- GitLab