11import { describe , expect , it } from 'vitest'
22
3- import { generateMetadata } from './meta.js'
3+ import { formatNextMetadata } from './meta.js'
44
5- describe ( 'generateMetadata ' , ( ) => {
5+ describe ( 'formatNextMetadata ' , ( ) => {
66 it ( 'should handle a string title with titleSuffix' , async ( ) => {
7- const result = await generateMetadata ( {
7+ const result = await formatNextMetadata ( {
88 serverURL : 'http://localhost:3000' ,
99 title : 'Dashboard' ,
1010 titleSuffix : '- My CMS' ,
@@ -14,7 +14,7 @@ describe('generateMetadata', () => {
1414 } )
1515
1616 it ( 'should apply titleSuffix to default and template fields of a TemplateString title object' , async ( ) => {
17- const result = await generateMetadata ( {
17+ const result = await formatNextMetadata ( {
1818 serverURL : 'http://localhost:3000' ,
1919 title : { default : 'Dashboard' , template : '%s | Dashboard' } ,
2020 titleSuffix : '- My CMS' ,
@@ -30,7 +30,7 @@ describe('generateMetadata', () => {
3030 } )
3131
3232 it ( 'should use the TemplateString default for ogTitle when title is a TemplateString object' , async ( ) => {
33- const result = await generateMetadata ( {
33+ const result = await formatNextMetadata ( {
3434 serverURL : 'http://localhost:3000' ,
3535 title : { default : 'My CMS' , template : '%s | My CMS' } ,
3636 titleSuffix : '- Payload' ,
@@ -41,7 +41,7 @@ describe('generateMetadata', () => {
4141 } )
4242
4343 it ( 'should use the TemplateString absolute for ogTitle when title has absolute property' , async ( ) => {
44- const result = await generateMetadata ( {
44+ const result = await formatNextMetadata ( {
4545 serverURL : 'http://localhost:3000' ,
4646 title : { absolute : 'My CMS Absolute' } ,
4747 titleSuffix : '- Payload' ,
@@ -51,7 +51,7 @@ describe('generateMetadata', () => {
5151 } )
5252
5353 it ( 'should apply titleSuffix to the absolute field of a TemplateString title object' , async ( ) => {
54- const result = await generateMetadata ( {
54+ const result = await formatNextMetadata ( {
5555 serverURL : 'http://localhost:3000' ,
5656 title : { absolute : 'My CMS Absolute' } ,
5757 titleSuffix : '- Payload' ,
@@ -62,7 +62,7 @@ describe('generateMetadata', () => {
6262 } )
6363
6464 it ( 'should use openGraph.title string over incomingMetadata.title for ogTitle' , async ( ) => {
65- const result = await generateMetadata ( {
65+ const result = await formatNextMetadata ( {
6666 serverURL : 'http://localhost:3000' ,
6767 title : 'My CMS' ,
6868 titleSuffix : '- Payload' ,
@@ -73,15 +73,15 @@ describe('generateMetadata', () => {
7373 } )
7474
7575 it ( 'should return undefined for metaTitle when no title and no titleSuffix are set' , async ( ) => {
76- const result = await generateMetadata ( {
76+ const result = await formatNextMetadata ( {
7777 serverURL : 'http://localhost:3000' ,
7878 } )
7979
8080 expect ( result . title ) . toBeUndefined ( )
8181 } )
8282
8383 it ( 'should return just the title when no titleSuffix is set' , async ( ) => {
84- const result = await generateMetadata ( {
84+ const result = await formatNextMetadata ( {
8585 serverURL : 'http://localhost:3000' ,
8686 title : 'My CMS' ,
8787 } )
0 commit comments