Skip to content

Commit 06949c5

Browse files
committed
chore: some test updates
1 parent 039141f commit 06949c5

File tree

2 files changed

+34
-24
lines changed

2 files changed

+34
-24
lines changed

test/e2e/app-dir/index.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('app dir', () => {
6464
})
6565
}
6666

67-
it('should use application/octet-stream for flight', async () => {
67+
it('should use text/x-component for flight', async () => {
6868
const res = await fetchViaHTTP(
6969
next.url,
7070
'/dashboard/deployments/123',
@@ -75,10 +75,10 @@ describe('app dir', () => {
7575
},
7676
},
7777
)
78-
expect(res.headers.get('Content-Type')).toBe('application/octet-stream')
78+
expect(res.headers.get('Content-Type')).toBe('text/x-component')
7979
})
8080

81-
it('should use application/octet-stream for flight with edge runtime', async () => {
81+
it('should use text/x-component for flight with edge runtime', async () => {
8282
const res = await fetchViaHTTP(
8383
next.url,
8484
'/dashboard',
@@ -89,7 +89,7 @@ describe('app dir', () => {
8989
},
9090
},
9191
)
92-
expect(res.headers.get('Content-Type')).toBe('application/octet-stream')
92+
expect(res.headers.get('Content-Type')).toBe('text/x-component')
9393
})
9494

9595
it('should pass props from getServerSideProps in root layout', async () => {
@@ -2093,12 +2093,12 @@ describe('app dir', () => {
20932093

20942094
it('should insert preload tags for beforeInteractive and afterInteractive scripts', async () => {
20952095
const html = await renderViaHTTP(next.url, '/script')
2096-
expect(html).toContain('<link href="/test1.js" rel="preload" as="script"/>')
2097-
expect(html).toContain('<link href="/test2.js" rel="preload" as="script"/>')
2098-
expect(html).toContain('<link href="/test3.js" rel="preload" as="script"/>')
2096+
expect(html).toContain('<link rel="preload" as="script" href="/test1.js"/>')
2097+
expect(html).toContain('<link rel="preload" as="script" href="/test2.js"/>')
2098+
expect(html).toContain('<link rel="preload" as="script" href="/test3.js"/>')
20992099

21002100
// test4.js has lazyOnload which doesn't need to be preloaded
2101-
expect(html).not.toContain('<script src="/test4.js" rel="preload" as="script"/>')
2101+
expect(html).not.toContain('<script rel="preload" as="script" href="/test4.js"/>')
21022102
})
21032103
})
21042104

test/e2e/app-dir/next-font.test.ts

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -170,22 +170,25 @@ describe('app dir next-font', () => {
170170
expect($('link[as="font"]').length).toBe(3)
171171
expect($('link[as="font"]').get(0).attribs).toEqual({
172172
as: 'font',
173-
crossorigin: '',
174-
href: '/_next/static/media/e9b9dc0d8ba35f48.p.woff2',
173+
crossorigin: 'anonymous',
174+
"data-next-font": 'size-adjust',
175+
href: '/_next/static/media/b2104791981359ae-s.p.woff2',
175176
rel: 'preload',
176177
type: 'font/woff2',
177178
})
178179
expect($('link[as="font"]').get(1).attribs).toEqual({
179180
as: 'font',
180-
crossorigin: '',
181-
href: '/_next/static/media/b61859a50be14c53.p.woff2',
181+
crossorigin: 'anonymous',
182+
"data-next-font": 'size-adjust',
183+
href: '/_next/static/media/b61859a50be14c53-s.p.woff2',
182184
rel: 'preload',
183185
type: 'font/woff2',
184186
})
185187
expect($('link[as="font"]').get(2).attribs).toEqual({
186188
as: 'font',
187-
crossorigin: '',
188-
href: '/_next/static/media/b2104791981359ae.p.woff2',
189+
crossorigin: 'anonymous',
190+
"data-next-font": 'size-adjust',
191+
href: '/_next/static/media/b2104791981359ae-s.p.woff2',
189192
rel: 'preload',
190193
type: 'font/woff2',
191194
})
@@ -202,22 +205,25 @@ describe('app dir next-font', () => {
202205
// From root layout
203206
expect($('link[as="font"]').get(0).attribs).toEqual({
204207
as: 'font',
205-
crossorigin: '',
206-
href: '/_next/static/media/e9b9dc0d8ba35f48.p.woff2',
208+
crossorigin: 'anonymous',
209+
"data-next-font": 'size-adjust',
210+
href: '/_next/static/media/e1053f04babc7571-s.p.woff2',
207211
rel: 'preload',
208212
type: 'font/woff2',
209213
})
210214

211215
expect($('link[as="font"]').get(1).attribs).toEqual({
212216
as: 'font',
213-
crossorigin: '',
217+
crossorigin: 'anonymous',
218+
"data-next-font": 'size-adjust',
214219
href: '/_next/static/media/e1053f04babc7571.p.woff2',
215220
rel: 'preload',
216221
type: 'font/woff2',
217222
})
218223
expect($('link[as="font"]').get(2).attribs).toEqual({
219224
as: 'font',
220-
crossorigin: '',
225+
crossorigin: 'anonymous',
226+
"data-next-font": 'size-adjust',
221227
href: '/_next/static/media/feab2c68f2a8e9a4.p.woff2',
222228
rel: 'preload',
223229
type: 'font/woff2',
@@ -235,15 +241,17 @@ describe('app dir next-font', () => {
235241
// From root layout
236242
expect($('link[as="font"]').get(0).attribs).toEqual({
237243
as: 'font',
238-
crossorigin: '',
239-
href: '/_next/static/media/e9b9dc0d8ba35f48.p.woff2',
244+
crossorigin: 'anonymous',
245+
"data-next-font": 'size-adjust',
246+
href: '/_next/static/media/75c5faeeb9c86969-s.p.woff2',
240247
rel: 'preload',
241248
type: 'font/woff2',
242249
})
243250

244251
expect($('link[as="font"]').get(1).attribs).toEqual({
245252
as: 'font',
246-
crossorigin: '',
253+
crossorigin: 'anonymous',
254+
"data-next-font": 'size-adjust',
247255
href: '/_next/static/media/75c5faeeb9c86969.p.woff2',
248256
rel: 'preload',
249257
type: 'font/woff2',
@@ -261,15 +269,17 @@ describe('app dir next-font', () => {
261269
// From root layout
262270
expect($('link[as="font"]').get(0).attribs).toEqual({
263271
as: 'font',
264-
crossorigin: '',
265-
href: '/_next/static/media/e9b9dc0d8ba35f48.p.woff2',
272+
crossorigin: 'anonymous',
273+
"data-next-font": 'size-adjust',
274+
href: '/_next/static/media/568e4c6d8123c4d6-s.p.woff2',
266275
rel: 'preload',
267276
type: 'font/woff2',
268277
})
269278

270279
expect($('link[as="font"]').get(1).attribs).toEqual({
271280
as: 'font',
272-
crossorigin: '',
281+
crossorigin: 'anonymous',
282+
"data-next-font": 'size-adjust',
273283
href: '/_next/static/media/568e4c6d8123c4d6.p.woff2',
274284
rel: 'preload',
275285
type: 'font/woff2',

0 commit comments

Comments
 (0)