Skip to content

Commit

Permalink
add and update test
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Apr 29, 2024
1 parent 20c7d30 commit e549ebf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/next/src/lib/metadata/resolvers/resolve-url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('resolveAbsoluteUrlWithPathname', () => {
})

describe('getSocialImageFallbackMetadataBase', () => {
describe('fallbackMetadataBase', () => {
describe('fallbackMetadataBase when metadataBase is not present', () => {
let originalEnv: NodeJS.ProcessEnv
function getSocialImageFallbackMetadataBaseHelper(): string {
return getSocialImageFallbackMetadataBase(null).fallbackMetadataBase.href
Expand All @@ -139,7 +139,7 @@ describe('getSocialImageFallbackMetadataBase', () => {
)
})

it('should return metadataBase ', () => {
it('should return local url in local build mode', () => {
// @ts-expect-error override process env
process.env.NODE_ENV = 'production'
expect(getSocialImageFallbackMetadataBaseHelper()).toBe(
Expand Down Expand Up @@ -171,6 +171,8 @@ describe('getSocialImageFallbackMetadataBase', () => {
it('should return project production url in production deployment', () => {
// @ts-expect-error override process env
process.env.NODE_ENV = 'production'
process.env.VERCEL_ENV = 'preview'
process.env.VERCEL_URL = 'vercel-url'
process.env.VERCEL_PROJECT_PRODUCTION_URL = 'production-url'
expect(getSocialImageFallbackMetadataBaseHelper()).toBe(
'https://production-url/'
Expand Down

0 comments on commit e549ebf

Please sign in to comment.