11/**
22 * @vitest -environment node
33 */
4- import { beforeEach , describe , expect , it , vi } from "vitest" ;
4+ import { assert , beforeEach , describe , expect , it , vi } from "vitest" ;
55import React from "react" ;
6+ import { logger } from "../../utils/logger" ;
67
78// Mock Next.js cookies
89vi . mock ( "next/headers" , ( ) => ( {
@@ -56,8 +57,10 @@ describe("Server-side rich text rendering", () => {
5657 a0 : ( chunks ) => < a href = "/home" > { chunks } </ a > ,
5758 } ) ;
5859
59- // Should return React element
60- expect ( React . isValidElement ( result ) ) . toBe ( true ) ;
60+ assert . isOk ( Array . isArray ( result ) ) ;
61+ result . forEach ( ( item ) => {
62+ expect ( React . isValidElement ( item ) ) . toBe ( true ) ;
63+ } ) ;
6164 } ) ;
6265
6366 it ( "should render mixed content with variables and components" , async ( ) => {
@@ -77,7 +80,10 @@ describe("Server-side rich text rendering", () => {
7780 } ,
7881 ) ;
7982
80- expect ( React . isValidElement ( result ) ) . toBe ( true ) ;
83+ assert . isOk ( Array . isArray ( result ) ) ;
84+ result . forEach ( ( item ) => {
85+ expect ( React . isValidElement ( item ) ) . toBe ( true ) ;
86+ } ) ;
8187 } ) ;
8288
8389 it ( "should handle the page.tsx example case" , async ( ) => {
@@ -104,6 +110,9 @@ describe("Server-side rich text rendering", () => {
104110 } ,
105111 ) ;
106112
107- expect ( React . isValidElement ( result ) ) . toBe ( true ) ;
113+ assert . isOk ( Array . isArray ( result ) ) ;
114+ result . forEach ( ( item ) => {
115+ expect ( React . isValidElement ( item ) ) . toBe ( true ) ;
116+ } ) ;
108117 } ) ;
109118} ) ;
0 commit comments