Skip to content

Commit fc07efc

Browse files
committed
Fix typing
1 parent 594b63b commit fc07efc

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"test:watch": "yarn test --watch",
99
"test": "jest --runInBand --selectProjects dom --selectProjects node",
1010
"test:build": "yarn build && jest --runInBand --selectProjects build",
11-
"test:e2e": "concurrently --kill-others -s first \"NODE_ENV=test yarn playground:javascript\" \"cypress run --env playground=javascript\"",
11+
"test:e2e": "concurrently --kill-others -s first \"NODE_ENV=test yarn playground:angular\" \"cypress run --env playground=angular\"",
1212
"test:e2e:all": "sh scripts/e2e.sh",
13-
"test:e2e:watch": "concurrently --kill-others -s first \"NODE_ENV=test yarn playground:javascript\" \"cypress open --env playground=javascript\"",
13+
"test:e2e:watch": "concurrently --kill-others -s first \"NODE_ENV=test yarn playground:angular\" \"cypress open --env playground=angular\"",
1414
"test:all": "yarn test:e2e:all && yarn test && test:build",
1515
"cy:open": "cypress open",
1616
"playground:vue": "yarn --cwd ./playgrounds/vue && yarn --cwd ./playgrounds/vue serve",
@@ -99,6 +99,6 @@
9999
"shx": "^0.3.3",
100100
"ts-jest": "^26.5.2",
101101
"tslib": "^2.3.1",
102-
"typescript": "^4.3.5"
102+
"typescript": "^4.4.3"
103103
}
104104
}

tests/snippets.tests.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('Snippet Browser test', () => {
2828
},
2929
},
3030
])
31-
const snippeted = response.results[0].hits[0]._highlightResult
31+
const snippeted = response.results[0]?.hits[0]?._highlightResult
3232
expect(snippeted.overview.value).toEqual('Princess')
3333
const resKeys = Object.keys(snippeted)
3434
expect(resKeys).toEqual(expect.arrayContaining(Object.keys(dataset[0])))
@@ -45,11 +45,11 @@ describe('Snippet Browser test', () => {
4545
},
4646
},
4747
])
48-
const highlighted = response.results[0].hits[0]._highlightResult
48+
const highlighted = response.results[0]?.hits[0]?._highlightResult
4949
const snippeted = response.results[0].hits[0]._snippetResult
5050
expect(highlighted.overview.value).toEqual('While')
5151
expect(snippeted.overview.value).toEqual('While...')
52-
const resKeys = Object.keys(response.results[0].hits[0]._highlightResult)
52+
const resKeys = Object.keys(response.results[0]?.hits[0]?._highlightResult)
5353

5454
expect(resKeys).toEqual(expect.arrayContaining(Object.keys(dataset[0])))
5555
})
@@ -68,7 +68,7 @@ describe('Snippet Browser test', () => {
6868
},
6969
])
7070

71-
const firstHitHighlight = response.results[0].hits[0]._highlightResult
71+
const firstHitHighlight = response.results[0]?.hits[0]?._highlightResult
7272
const firstHitSnippet = response.results[0].hits[0]._snippetResult
7373

7474
expect(firstHitHighlight.title.value).toEqual('<p>S</p>tar Wars')
@@ -80,14 +80,14 @@ describe('Snippet Browser test', () => {
8080
'Luke <p>S</p>kywalker and...'
8181
)
8282

83-
const secondHitHighlight = response.results[0].hits[1]._highlightResult
84-
const secondHitSnippet = response.results[0].hits[1]._snippetResult
83+
const secondHitHighlight = response.results[0]?.hits[1]?._highlightResult
84+
const secondHitSnippet = response.results[0]?.hits[1]?._snippetResult
8585
expect(secondHitHighlight.title.value).toEqual('Four')
8686
expect(secondHitHighlight.overview.value).toEqual("It'<p>s</p> Ted")
8787
expect(secondHitSnippet.title.value).toEqual('Four...')
8888
expect(secondHitSnippet.overview.value).toEqual("It'<p>s</p> Ted...")
8989

90-
const resKeys = Object.keys(response.results[0].hits[0]._highlightResult)
90+
const resKeys = Object.keys(response.results[0]?.hits[0]?._highlightResult)
9191
expect(resKeys).toEqual(expect.arrayContaining(Object.keys(dataset[0])))
9292
})
9393

@@ -102,10 +102,10 @@ describe('Snippet Browser test', () => {
102102
},
103103
])
104104

105-
const firstHit = response.results[0].hits[0]._highlightResult
105+
const firstHit = response.results[0]?.hits[0]?._highlightResult
106106
expect(firstHit.overview.value).toEqual('null')
107107

108-
const resKeys = Object.keys(response.results[0].hits[0]._highlightResult)
108+
const resKeys = Object.keys(response.results[0]?.hits[0]?._highlightResult)
109109
expect(resKeys).toEqual(expect.arrayContaining(Object.keys(dataset[0])))
110110
})
111111

@@ -119,7 +119,7 @@ describe('Snippet Browser test', () => {
119119
},
120120
},
121121
])
122-
const snippeted = response.results[0].hits[0]._highlightResult
122+
const snippeted = response.results[0]?.hits[0]?._highlightResult
123123
expect(snippeted.overview.value).toEqual('Princess')
124124
const resKeys = Object.keys(snippeted)
125125
expect(resKeys).toEqual(expect.arrayContaining(Object.keys(dataset[0])))
@@ -135,9 +135,9 @@ describe('Snippet Browser test', () => {
135135
},
136136
},
137137
])
138-
const snippeted = response.results[0].hits[0]._highlightResult?.overview
138+
const snippeted = response.results[0]?.hits[0]?._highlightResult?.overview
139139
expect(snippeted.value).toEqual('While')
140-
const resKeys = Object.keys(response.results[0].hits[0]._highlightResult)
140+
const resKeys = Object.keys(response.results[0]?.hits[0]?._highlightResult)
141141
expect(resKeys).toEqual(expect.arrayContaining(Object.keys(dataset[0])))
142142
})
143143

@@ -151,7 +151,7 @@ describe('Snippet Browser test', () => {
151151
},
152152
},
153153
])
154-
const firstHit = response.results[0].hits[0]._highlightResult
154+
const firstHit = response.results[0]?.hits[0]?._highlightResult
155155

156156
expect(firstHit.title.value).toEqual(
157157
'__ais-highlight__S__/ais-highlight__tar Wars'
@@ -165,7 +165,7 @@ describe('Snippet Browser test', () => {
165165
"It'__ais-highlight__s__/ais-highlight__ Ted"
166166
)
167167

168-
const resKeys = Object.keys(response.results[0].hits[0]._highlightResult)
168+
const resKeys = Object.keys(response.results[0]?.hits[0]?._highlightResult)
169169
expect(resKeys).toEqual(expect.arrayContaining(Object.keys(dataset[0])))
170170
})
171171

@@ -180,9 +180,9 @@ describe('Snippet Browser test', () => {
180180
},
181181
])
182182

183-
const firstHit = response.results[0].hits[0]._highlightResult
183+
const firstHit = response.results[0]?.hits[0]?._highlightResult
184184
expect(firstHit.overview.value).toEqual('null')
185-
const resKeys = Object.keys(response.results[0].hits[0]._highlightResult)
185+
const resKeys = Object.keys(response.results[0]?.hits[0]?._highlightResult)
186186
expect(resKeys).toEqual(expect.arrayContaining(Object.keys(dataset[0])))
187187
})
188188
})

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7577,10 +7577,10 @@ typedarray@^0.0.6:
75777577
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
75787578
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
75797579

7580-
typescript@^4.3.5:
7581-
version "4.3.5"
7582-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
7583-
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
7580+
typescript@^4.4.3:
7581+
version "4.4.3"
7582+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324"
7583+
integrity sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==
75847584

75857585
unicode-canonical-property-names-ecmascript@^1.0.4:
75867586
version "1.0.4"

0 commit comments

Comments
 (0)