-
Notifications
You must be signed in to change notification settings - Fork 27.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[metadata] add option of configuring ua of async metadata
add config schema update test use a different config serve differently based on the config rename
- Loading branch information
Showing
16 changed files
with
216 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
test/e2e/app-dir/metadata-streaming/metadata-streaming-customized-rule.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
|
||
describe('app-dir - metadata-streaming-customized-rule', () => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
overrideFiles: { | ||
'next.config.js': ` | ||
module.exports = { | ||
experimental: { | ||
streamingMetadata: true, | ||
htmlLimitedBots: /Minibot/i, | ||
} | ||
} | ||
`, | ||
}, | ||
}) | ||
|
||
it('should send the blocking response for html limited bots', async () => { | ||
const $ = await next.render$( | ||
'/', | ||
undefined, // no query | ||
{ | ||
headers: { | ||
'user-agent': 'Minibot', | ||
}, | ||
} | ||
) | ||
expect(await $('title').text()).toBe('index page') | ||
}) | ||
|
||
it('should send streaming response for headless browser bots', async () => { | ||
const $ = await next.render$( | ||
'/', | ||
undefined, // no query | ||
{ | ||
headers: { | ||
'user-agent': 'Weebot', | ||
}, | ||
} | ||
) | ||
expect(await $('title').length).toBe(0) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
test/production/app-dir/metadata-streaming-config/app/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ReactNode } from 'react' | ||
export default function Root({ children }: { children: ReactNode }) { | ||
return ( | ||
<html> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
3 changes: 3 additions & 0 deletions
3
test/production/app-dir/metadata-streaming-config/app/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <p>hello world</p> | ||
} |
36 changes: 36 additions & 0 deletions
36
...production/app-dir/metadata-streaming-config/metadata-streaming-config-customized.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
|
||
describe('app-dir - metadata-streaming-config-customized', () => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
overrideFiles: { | ||
'next.config.js': ` | ||
module.exports = { | ||
experimental: { | ||
htmlLimitedBots: /MyBot/i, | ||
} | ||
} | ||
`, | ||
}, | ||
}) | ||
|
||
it('should have the default streaming metadata config output in routes-manifest.json', async () => { | ||
const requiredServerFiles = JSON.parse( | ||
await next.readFile('.next/required-server-files.json') | ||
) | ||
expect(requiredServerFiles.files).toContain( | ||
'.next/response-config-manifest.json' | ||
) | ||
|
||
const responseConfigManifest = JSON.parse( | ||
await next.readFile('.next/response-config-manifest.json') | ||
) | ||
|
||
expect(responseConfigManifest).toMatchInlineSnapshot(` | ||
{ | ||
"htmlLimitedBots": "MyBot", | ||
"version": 0, | ||
} | ||
`) | ||
}) | ||
}) |
Oops, something went wrong.