Skip to content

Commit 9c2c395

Browse files
authored
Merge pull request #2819 from ORCID/lmendpoza/PD-0000/fix-format
PD-0000 fix-format
2 parents 0d31772 + 13251a7 commit 9c2c395

3 files changed

Lines changed: 28 additions & 22 deletions

File tree

src/app/core/wordpress/wordpress.service.spec.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ describe('WordpressService', () => {
9696

9797
const indexReq = httpMock.expectOne(primaryIndexUrl)
9898
indexReq.flush(mockIndex)
99-
const cssReq = httpMock.expectOne(
100-
`${WORDPRESS_S3}/wordpress-homepage.css`
101-
)
99+
const cssReq = httpMock.expectOne(`${WORDPRESS_S3}/wordpress-homepage.css`)
102100
cssReq.flush(mockCss)
103101
})
104102

@@ -108,9 +106,7 @@ describe('WordpressService', () => {
108106
const mockJs = 'const image = "./assets/test.png"'
109107

110108
service.getHomePageJS().subscribe((js) => {
111-
expect(js).toContain(
112-
`const image = "${WORDPRESS_S3}/assets/test.png"`
113-
)
109+
expect(js).toContain(`const image = "${WORDPRESS_S3}/assets/test.png"`)
114110
})
115111

116112
const indexReq = httpMock.expectOne(primaryIndexUrl)
@@ -127,9 +123,7 @@ describe('WordpressService', () => {
127123
const mockJs = 'const icon = "./assets/icon.svg"'
128124

129125
service.getHomePageModulesJS().subscribe((js) => {
130-
expect(js).toContain(
131-
`const icon = "${WORDPRESS_S3}/assets/icon.svg"`
132-
)
126+
expect(js).toContain(`const icon = "${WORDPRESS_S3}/assets/icon.svg"`)
133127
})
134128

135129
const indexReq = httpMock.expectOne(primaryIndexUrl)

src/app/core/wordpress/wordpress.service.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ type HomePageAssetType = 'css' | 'classicScript' | 'moduleScript'
99
providedIn: 'root',
1010
})
1111
export class WordpressService {
12-
private homePageIndex$: Observable<{ html: string; url: string }> | null = null
12+
private homePageIndex$: Observable<{ html: string; url: string }> | null =
13+
null
1314

1415
constructor(
1516
private httpClient: HttpClient,
@@ -63,9 +64,10 @@ export class WordpressService {
6364
runtimeEnvironment.WORDPRESS_S3_FALLBACK
6465
}/index${this.getWordpressLocalizationCode()}.html`
6566

66-
this.homePageIndex$ = this.fetchWithFallback(primaryUrl, fallbackUrl).pipe(
67-
shareReplay(1)
68-
)
67+
this.homePageIndex$ = this.fetchWithFallback(
68+
primaryUrl,
69+
fallbackUrl
70+
).pipe(shareReplay(1))
6971
}
7072

7173
return this.homePageIndex$
@@ -88,7 +90,9 @@ export class WordpressService {
8890

8991
return this.httpClient.get(assetUrl, { responseType: 'text' }).pipe(
9092
map((html: string) => ({ html, url: assetUrl })),
91-
catchError(() => this.fetchWithFallback(fallbackPrimary, fallbackSecondary))
93+
catchError(() =>
94+
this.fetchWithFallback(fallbackPrimary, fallbackSecondary)
95+
)
9296
)
9397
})
9498
)

src/app/home/pages/home/home.component.spec.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ describe('HomeComponent', () => {
1919

2020
beforeEach(() => {
2121
togglzState$ = new Subject<boolean>()
22-
wordpressService = jasmine.createSpyObj<WordpressService>('WordpressService', [
23-
'getHomePageCSS',
24-
'getHomePagePost',
25-
'getHomePageJS',
26-
'getHomePageModulesJS',
27-
])
28-
wordpressService.getHomePageCSS.and.returnValue(of('body { color: black; }'))
22+
wordpressService = jasmine.createSpyObj<WordpressService>(
23+
'WordpressService',
24+
[
25+
'getHomePageCSS',
26+
'getHomePagePost',
27+
'getHomePageJS',
28+
'getHomePageModulesJS',
29+
]
30+
)
31+
wordpressService.getHomePageCSS.and.returnValue(
32+
of('body { color: black; }')
33+
)
2934
wordpressService.getHomePagePost.and.returnValue(
3035
of('<html><body><div>Homepage</div></body></html>')
3136
)
@@ -43,7 +48,10 @@ describe('HomeComponent', () => {
4348
provide: PlatformInfoService,
4449
useValue: { get: () => of({ columns12: true }) },
4550
},
46-
{ provide: TogglzService, useValue: { getStateOf: () => togglzState$ } },
51+
{
52+
provide: TogglzService,
53+
useValue: { getStateOf: () => togglzState$ },
54+
},
4755
{ provide: WordpressService, useValue: wordpressService },
4856
],
4957
schemas: [CUSTOM_ELEMENTS_SCHEMA],

0 commit comments

Comments
 (0)