Skip to content

chore: replace next/legacy/image with next/image #1722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 28, 2022
11 changes: 5 additions & 6 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ describe('onBuild()', () => {
expect(config.config.env.NEXTAUTH_URL).toEqual(mockUserDefinedSiteUrl)
})

test('sets the NEXTAUTH_URL to the DEPLOY_PRIME_URL when CONTEXT env variable is not \'production\'', async () => {
test("sets the NEXTAUTH_URL to the DEPLOY_PRIME_URL when CONTEXT env variable is not 'production'", async () => {
const mockUserDefinedSiteUrl = chance.url()
process.env.DEPLOY_PRIME_URL = mockUserDefinedSiteUrl
process.env.URL = chance.url()

// See https://docs.netlify.com/configure-builds/environment-variables/#build-metadata for all possible values
process.env.CONTEXT = 'deploy-preview'

Expand All @@ -277,8 +277,8 @@ describe('onBuild()', () => {

expect(config.config.env.NEXTAUTH_URL).toEqual(mockUserDefinedSiteUrl)
})
test('sets the NEXTAUTH_URL to the user defined site URL when CONTEXT env variable is \'production\'', async () => {

test("sets the NEXTAUTH_URL to the user defined site URL when CONTEXT env variable is 'production'", async () => {
const mockUserDefinedSiteUrl = chance.url()
process.env.DEPLOY_PRIME_URL = chance.url()
process.env.URL = mockUserDefinedSiteUrl
Expand All @@ -300,7 +300,6 @@ describe('onBuild()', () => {

expect(config.config.env.NEXTAUTH_URL).toEqual(mockUserDefinedSiteUrl)
})


test('sets the NEXTAUTH_URL specified in the netlify.toml or in the Netlify UI', async () => {
const mockSiteUrl = chance.url()
Expand Down Expand Up @@ -615,7 +614,7 @@ describe('onBuild()', () => {
const imageConfigPath = path.join(constants.INTERNAL_FUNCTIONS_SRC, IMAGE_FUNCTION_NAME, 'imageconfig.json')
const imageConfigJson = await readJson(imageConfigPath)

expect(imageConfigJson.domains.length).toBe(2)
expect(imageConfigJson.domains.length).toBe(1)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect(imageConfigJson.remotePatterns.length).toBe(1)
expect(imageConfigJson.responseHeaders).toStrictEqual({
'X-Foo': mockHeaderValue,
Expand Down