@@ -128,6 +128,30 @@ describe('isLogAttributeValue', () => {
128128 it ( 'should accept objects with byte arrays' , ( ) => {
129129 assert . strictEqual ( isLogAttributeValue ( { bytes : new Uint8Array ( [ 1 , 2 , 3 ] ) } ) , true ) ;
130130 } ) ;
131+
132+ it ( 'should accept plain objects without prototypes' , ( ) => {
133+ const objWithoutProto = Object . create ( null ) ;
134+ objWithoutProto . key = 'value' ;
135+ objWithoutProto . number = 42 ;
136+ assert . strictEqual ( isLogAttributeValue ( objWithoutProto ) , true ) ;
137+ } ) ;
138+
139+ it ( 'should accept nested objects without prototypes' , ( ) => {
140+ const parent = Object . create ( null ) ;
141+ const child = Object . create ( null ) ;
142+ child . deep = 'value' ;
143+ parent . nested = child ;
144+ parent . regular = { withProto : true } ;
145+ assert . strictEqual ( isLogAttributeValue ( parent ) , true ) ;
146+ } ) ;
147+
148+ it ( 'should accept objects without prototypes containing arrays' , ( ) => {
149+ const obj = Object . create ( null ) ;
150+ obj . strings = [ 'a' , 'b' , 'c' ] ;
151+ obj . mixed = [ 1 , 'two' , true ] ;
152+ obj . bytes = new Uint8Array ( [ 1 , 2 , 3 ] ) ;
153+ assert . strictEqual ( isLogAttributeValue ( obj ) , true ) ;
154+ } ) ;
131155 } ) ;
132156
133157 describe ( 'should accept complex combinations' , ( ) => {
@@ -193,16 +217,40 @@ describe('isLogAttributeValue', () => {
193217 assert . strictEqual ( isLogAttributeValue ( new TestClass ( ) ) , false ) ;
194218 } ) ;
195219
220+ it ( 'should reject Map objects' , ( ) => {
221+ assert . strictEqual ( isLogAttributeValue ( new Map ( ) ) , false ) ;
222+ assert . strictEqual ( isLogAttributeValue ( new Map ( [ [ 'key' , 'value' ] ] ) ) , false ) ;
223+
224+ const nestedMap = new Map ( ) ;
225+ nestedMap . set ( 'nested' , new Map ( [ [ 'inner' , 'value' ] ] ) ) ;
226+ assert . strictEqual ( isLogAttributeValue ( nestedMap ) , false ) ;
227+ } ) ;
228+
229+ it ( 'should reject Set objects' , ( ) => {
230+ assert . strictEqual ( isLogAttributeValue ( new Set ( ) ) , false ) ;
231+ assert . strictEqual ( isLogAttributeValue ( new Set ( [ 1 , 2 , 3 ] ) ) , false ) ;
232+ assert . strictEqual ( isLogAttributeValue ( new Set ( [ 'a' , 'b' , 'c' ] ) ) , false ) ;
233+ } ) ;
234+
235+ it ( 'should reject WeakMap and WeakSet objects' , ( ) => {
236+ assert . strictEqual ( isLogAttributeValue ( new WeakMap ( ) ) , false ) ;
237+ assert . strictEqual ( isLogAttributeValue ( new WeakSet ( ) ) , false ) ;
238+ } ) ;
239+
196240 it ( 'should reject arrays containing invalid values' , ( ) => {
197241 assert . strictEqual ( isLogAttributeValue ( [ 'valid' , ( ) => { } ] ) , false ) ;
198242 assert . strictEqual ( isLogAttributeValue ( [ Symbol ( 'test' ) , 'valid' ] ) , false ) ;
199243 assert . strictEqual ( isLogAttributeValue ( [ new Date ( ) ] ) , false ) ;
244+ assert . strictEqual ( isLogAttributeValue ( [ new Map ( ) ] ) , false ) ;
245+ assert . strictEqual ( isLogAttributeValue ( [ 'valid' , new Set ( [ 1 , 2 , 3 ] ) ] ) , false ) ;
200246 } ) ;
201247
202248 it ( 'should reject objects containing invalid values' , ( ) => {
203249 assert . strictEqual ( isLogAttributeValue ( { valid : 'test' , invalid : ( ) => { } } ) , false ) ;
204250 assert . strictEqual ( isLogAttributeValue ( { symbol : Symbol ( 'test' ) } ) , false ) ;
205251 assert . strictEqual ( isLogAttributeValue ( { date : new Date ( ) } ) , false ) ;
252+ assert . strictEqual ( isLogAttributeValue ( { map : new Map ( [ [ 'key' , 'value' ] ] ) } ) , false ) ;
253+ assert . strictEqual ( isLogAttributeValue ( { set : new Set ( [ 1 , 2 , 3 ] ) } ) , false ) ;
206254 } ) ;
207255
208256 it ( 'should reject deeply nested invalid values' , ( ) => {
0 commit comments