@newskit-render/core 0.131.1 → 0.138.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +169 -0
- package/README.md +1 -1
- package/__pacts__/client.ts +10 -6
- package/__tests__/pages/[articleSlug].test.tsx +20 -7
- package/__tests__/pages/__snapshots__/home.test.tsx.snap +599 -690
- package/__tests__/pages/home.test.tsx +22 -10
- package/components/404/404.tsx +9 -5
- package/components/article/__tests__/__snapshots__/index.test.tsx.snap +650 -687
- package/components/common/NavLink.tsx +4 -3
- package/components/footer/__snapshots__/index.test.tsx.snap +15 -23
- package/components/header/index.tsx +4 -3
- package/components/section/__tests__/ArticleSlice.test.tsx +2 -2
- package/components/section/layouts/FallBack.tsx +3 -3
- package/components/section/layouts/SectionRow.tsx +4 -3
- package/components/section/layouts/__tests__/__snapshots__/Lead.test.tsx.snap +152 -167
- package/components/section/layouts/__tests__/__snapshots__/SectionRow.test.tsx.snap +857 -952
- package/helpers/addCacheHeaders.ts +8 -0
- package/infrastructure/.circleci/config.yml +2 -2
- package/jest.config.js +4 -0
- package/jest.config.pact.js +3 -2
- package/package.json +11 -9
- package/pages/[section]/[articleId]/[articleSlug].tsx +11 -4
- package/pages/[section]/index.tsx +11 -4
- package/pages/api/account/zuora/generate-rsa.ts +5 -0
- package/pages/index.tsx +11 -4
- package/pages/preview/[articleId]/version/[versionId]/index.tsx +4 -2
- package/temp/header.tsx +4 -3
- package/tsconfig.json +3 -2
- package/helpers/createApolloClient.tsx +0 -28
|
@@ -3,19 +3,24 @@ import SectionPage from '../../components/section'
|
|
|
3
3
|
import { renderWithTheme } from '../../helpers/test-utils'
|
|
4
4
|
import { getPageMock } from '../../helpers/mocks'
|
|
5
5
|
|
|
6
|
-
jest.mock('
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
jest.mock('@newskit-render/api', () => ({
|
|
7
|
+
ClientTypes: { nkapi: 'nkapi' },
|
|
8
|
+
createApolloClient: jest.fn().mockImplementation(() => {
|
|
9
|
+
return Promise.resolve({
|
|
10
|
+
query: jest.fn().mockResolvedValueOnce({
|
|
11
|
+
data: {
|
|
12
|
+
page: {
|
|
13
|
+
data: {
|
|
14
|
+
id: '123',
|
|
15
|
+
title: 'Test title',
|
|
16
|
+
},
|
|
14
17
|
},
|
|
15
18
|
},
|
|
16
|
-
},
|
|
19
|
+
}),
|
|
17
20
|
})
|
|
18
|
-
),
|
|
21
|
+
}),
|
|
22
|
+
sessionParser: jest.fn(),
|
|
23
|
+
getMainSession: jest.fn(),
|
|
19
24
|
}))
|
|
20
25
|
|
|
21
26
|
jest.mock('cross-fetch', () =>
|
|
@@ -44,8 +49,10 @@ describe('getServerSideProps', () => {
|
|
|
44
49
|
expect(asFragment()).toMatchSnapshot()
|
|
45
50
|
})
|
|
46
51
|
test('should call newskit api and return Page data', async () => {
|
|
52
|
+
const setHeaderMock = jest.fn()
|
|
47
53
|
const response = await getServerSideProps({
|
|
48
54
|
req: { headers: { cookie: 'session-cookie' } },
|
|
55
|
+
res: { setHeader: setHeaderMock },
|
|
49
56
|
})
|
|
50
57
|
expect(response).toEqual(
|
|
51
58
|
expect.objectContaining({
|
|
@@ -62,5 +69,10 @@ describe('getServerSideProps', () => {
|
|
|
62
69
|
},
|
|
63
70
|
})
|
|
64
71
|
)
|
|
72
|
+
|
|
73
|
+
expect(setHeaderMock).toHaveBeenCalledWith(
|
|
74
|
+
'Cache-Control',
|
|
75
|
+
'public, s-maxage=10, stale-while-revalidate=59'
|
|
76
|
+
)
|
|
65
77
|
})
|
|
66
78
|
})
|
package/components/404/404.tsx
CHANGED
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
Cell,
|
|
5
5
|
Image,
|
|
6
6
|
TextBlock,
|
|
7
|
-
LinkStandalone,
|
|
8
7
|
IconFilledKeyboardArrowLeft,
|
|
9
8
|
styled,
|
|
10
9
|
getMediaQueryFromTheme,
|
|
11
10
|
getSizingCssFromTheme,
|
|
12
11
|
} from 'newskit'
|
|
13
12
|
import Head from 'next/head'
|
|
13
|
+
import { NextLink } from '@newskit-render/shared-components'
|
|
14
14
|
import Layout from '../layout'
|
|
15
15
|
import { headerSize } from '../header'
|
|
16
16
|
|
|
@@ -46,9 +46,12 @@ const StyledMain = styled.main`
|
|
|
46
46
|
max-width: 440px;
|
|
47
47
|
}
|
|
48
48
|
`
|
|
49
|
+
const paddingCB = (size: string) => ({
|
|
50
|
+
padding: `${size} 0`,
|
|
51
|
+
})
|
|
49
52
|
|
|
50
|
-
const
|
|
51
|
-
|
|
53
|
+
const StyledLink = styled(NextLink)`
|
|
54
|
+
${getSizingCssFromTheme(paddingCB, 'sizing030')}
|
|
52
55
|
`
|
|
53
56
|
|
|
54
57
|
const gridOverride = {
|
|
@@ -101,7 +104,8 @@ const FourOhFour = () => (
|
|
|
101
104
|
<Block
|
|
102
105
|
spaceStack={{ xs: 'space070', sm: 'space080', md: 'space090' }}
|
|
103
106
|
>
|
|
104
|
-
<
|
|
107
|
+
<StyledLink
|
|
108
|
+
type="standalone"
|
|
105
109
|
data-test-id="StyledLinkStandalone"
|
|
106
110
|
href="/"
|
|
107
111
|
external={false}
|
|
@@ -114,7 +118,7 @@ const FourOhFour = () => (
|
|
|
114
118
|
}}
|
|
115
119
|
/>
|
|
116
120
|
Back to ...
|
|
117
|
-
</
|
|
121
|
+
</StyledLink>
|
|
118
122
|
</Block>
|
|
119
123
|
</StyledMain>
|
|
120
124
|
</Cell>
|