@newskit-render/core 1.87.1 → 1.87.3-alpha.0

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 CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.87.2](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.87.2-alpha.0...@newskit-render/core@1.87.2) (2022-09-08)
7
+
8
+ **Note:** Version bump only for package @newskit-render/core
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.87.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.87.1-alpha.0...@newskit-render/core@1.87.1) (2022-09-08)
15
+
16
+ **Note:** Version bump only for package @newskit-render/core
17
+
18
+
19
+
20
+
21
+
6
22
  # [1.87.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.87.0-alpha.0...@newskit-render/core@1.87.0) (2022-09-07)
7
23
 
8
24
  **Note:** Version bump only for package @newskit-render/core
@@ -0,0 +1,80 @@
1
+ import { GraphQLInteraction, Matchers } from '@pact-foundation/pact'
2
+ import { print } from 'graphql/language/printer'
3
+ import { GET_UNIVERSAL_ARTICLE } from '../../../queries'
4
+
5
+ const { like, eachLike } = Matchers
6
+
7
+ const interactUniversalArticle = ({
8
+ id,
9
+ publisher,
10
+ }: {
11
+ id: string
12
+ publisher: string
13
+ }) => {
14
+ return new GraphQLInteraction()
15
+ .uponReceiving('Universal Article')
16
+ .withRequest({
17
+ path: '/',
18
+ method: 'POST',
19
+ headers: {
20
+ 'content-type': 'application/json',
21
+ },
22
+ })
23
+ .withOperation('getUniversalArticle')
24
+ .withQuery(print(GET_UNIVERSAL_ARTICLE))
25
+ .withVariables({ id, publisher })
26
+ .willRespondWith({
27
+ status: 200,
28
+ body: {
29
+ data: {
30
+ universalArticle: {
31
+ id: like('17842504'),
32
+ url: like('https://mock-site-url/some-location'),
33
+ label: like(''),
34
+ slug: like('some-location'),
35
+ publisher: like('DEMO'),
36
+ headline: like(
37
+ "Drying your wet iPhone in rice 'is a MYTH' – how to save a soaked mobile"
38
+ ),
39
+ kicker: like('WAT-ER PUZZLE!'),
40
+ flags: eachLike(''),
41
+ topics: [
42
+ {
43
+ name: like('some name'),
44
+ slug: like('some name'),
45
+ link: like('some name'),
46
+ },
47
+ ],
48
+ template: like('theme-tech'),
49
+ bylines: [
50
+ {
51
+ type: like('inline'),
52
+ value: like('Sean Keach'),
53
+ },
54
+ ],
55
+ publishedDateTime: like('2022-03-04T11:35:13.000Z'),
56
+ updatedDateTime: like('2022-03-04T11:35:18.000Z'),
57
+ summary: {
58
+ children: [
59
+ {
60
+ text: like(
61
+ 'There are more effective ways to dry out your iPhone – and using rice could even cause damage to your handset.'
62
+ ),
63
+ },
64
+ ],
65
+ },
66
+ media: {
67
+ crops: eachLike({
68
+ url:
69
+ 'https://www.thesun.co.uk/wp-content/uploads/2022/03/iphone-in-rice.jpg?strip=all&w=620&h=413&crop=1',
70
+ alt: null,
71
+ aspectRatio: 'landscape',
72
+ }),
73
+ },
74
+ },
75
+ },
76
+ },
77
+ })
78
+ }
79
+
80
+ export default interactUniversalArticle
@@ -1,82 +1,17 @@
1
- import { GraphQLInteraction, Matchers } from '@pact-foundation/pact'
2
- import { print } from 'graphql/language/printer'
3
1
  import provider from './newskitApi.mock.provider'
4
2
  import getUniversalArticle from '../client'
5
- import { GET_UNIVERSAL_ARTICLE } from '../../queries'
6
-
7
- const { like, eachLike } = Matchers
3
+ import interactUniversalArticle from './interactions/interactUniversalArticle'
8
4
 
9
5
  describe('Test pact with Newskit Api', () => {
10
6
  describe('When a request to get Universal Article is made', () => {
11
7
  beforeAll(async () => {
12
- await provider.setup().then(() => {
13
- const id = '17842504'
14
- const publisher = 'DEMO'
15
- provider.addInteraction(
16
- new GraphQLInteraction()
17
- .uponReceiving('Universal Article')
18
- .withRequest({
19
- path: '/',
20
- method: 'POST',
21
- headers: {
22
- 'content-type': 'application/json',
23
- },
24
- })
25
- .withOperation('getUniversalArticle')
26
- .withQuery(print(GET_UNIVERSAL_ARTICLE))
27
- .withVariables({ id, publisher })
28
- .willRespondWith({
29
- status: 200,
30
- body: {
31
- data: {
32
- universalArticle: {
33
- id: like('17842504'),
34
- url: like('https://mock-site-url/some-location'),
35
- // label: like(''),
36
- slug: like('some-location'),
37
- publisher: like('DEMO'),
38
- headline: like(
39
- "Drying your wet iPhone in rice 'is a MYTH' – how to save a soaked mobile"
40
- ),
41
- kicker: like('WAT-ER PUZZLE!'),
42
- flags: eachLike(''),
43
- bylines: [
44
- {
45
- type: like('inline'),
46
- value: like('Sean Keach'),
47
- },
48
- ],
49
- publishedDateTime: like('2022-03-04T11:35:13.000Z'),
50
- updatedDateTime: like('2022-03-04T11:35:18.000Z'),
51
- summary: {
52
- children: [
53
- {
54
- text: like(
55
- 'There are more effective ways to dry out your iPhone – and using rice could even cause damage to your handset.'
56
- ),
57
- },
58
- ],
59
- },
60
- media: {
61
- crops: eachLike({
62
- url:
63
- 'https://www.thesun.co.uk/wp-content/uploads/2022/03/iphone-in-rice.jpg?strip=all&w=620&h=413&crop=1',
64
- alt: null,
65
- aspectRatio: 'landscape',
66
- }),
67
- },
68
- },
69
- },
70
- },
71
- })
72
- )
73
- })
8
+ await provider.setup()
74
9
  })
75
10
 
76
11
  test('should return the correct data', async () => {
77
- await expect(
78
- getUniversalArticle({ id: '17842504', publisher: 'DEMO' })
79
- ).resolves.not.toThrowError()
12
+ const article = { id: '17842504', publisher: 'DEMO' }
13
+ await provider.addInteraction(interactUniversalArticle(article))
14
+ await expect(getUniversalArticle(article)).resolves.not.toThrowError()
80
15
  })
81
16
 
82
17
  afterEach(() => {
@@ -7,6 +7,6 @@ export default new Pact({
7
7
  dir: path.resolve(__dirname, '../pacts'),
8
8
  log: path.resolve(__dirname, '../logs', 'pact.log'),
9
9
  logLevel: 'debug',
10
- port: +(process.env.PORT || '3000'),
10
+ port: +process.env.PORT,
11
11
  spec: 2,
12
12
  })
package/newrelic.js CHANGED
@@ -37,6 +37,7 @@ exports.config = {
37
37
  * production applications.
38
38
  */
39
39
  level: 'trace',
40
+ filepath: '',
40
41
  },
41
42
  /**
42
43
  * When true, all request headers except for those listed in attributes.exclude
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newskit-render/core",
3
- "version": "1.87.1",
3
+ "version": "1.87.3-alpha.0",
4
4
  "description": "Newskit Render - Core package",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",