@@ -9,7 +9,7 @@ require('./setup/core')
99
1010describe ( 'process-tags' , ( ) => {
1111 const processTags = require ( '../src/process-tags' )
12- const { serialize , sanitize } = require ( '../src/process-tags' )
12+ const { sanitize } = require ( '../src/process-tags' )
1313
1414 describe ( 'field name constants' , ( ) => {
1515 it ( 'should define field names for different subsystems' , ( ) => {
@@ -125,88 +125,6 @@ describe('process-tags', () => {
125125 } )
126126 } )
127127
128- describe ( 'serialize' , ( ) => {
129- it ( 'should serialize tags as name:value pairs joined by commas' , ( ) => {
130- const tags = [
131- [ 'tag1' , 'value1' ] ,
132- [ 'tag2' , 'value2' ] ,
133- [ 'tag3' , 'value3' ]
134- ]
135-
136- const result = serialize ( tags )
137-
138- assert . strictEqual ( result , 'tag1:value1,tag2:value2,tag3:value3' )
139- } )
140-
141- it ( 'should filter out tags with undefined values' , ( ) => {
142- const tags = [
143- [ 'tag1' , 'value1' ] ,
144- [ 'tag2' , undefined ] ,
145- [ 'tag3' , 'value3' ] ,
146- [ 'tag4' , undefined ]
147- ]
148-
149- const result = serialize ( tags )
150-
151- assert . strictEqual ( result , 'tag1:value1,tag3:value3' )
152- assert . doesNotMatch ( result , / u n d e f i n e d / )
153- } )
154-
155- it ( 'should sanitize tag values' , ( ) => {
156- const tags = [
157- [ 'tag1' , 'Value With Spaces' ] ,
158- [ 'tag2' , 'UPPERCASE' ] ,
159- [ 'tag3' , 'special@chars!' ]
160- ]
161-
162- const result = serialize ( tags )
163-
164- assert . strictEqual ( result , 'tag1:value_with_spaces,tag2:uppercase,tag3:special_chars_' )
165- } )
166-
167- it ( 'should return empty string when all values are undefined' , ( ) => {
168- const tags = [
169- [ 'tag1' , undefined ] ,
170- [ 'tag2' , undefined ]
171- ]
172-
173- const result = serialize ( tags )
174-
175- assert . strictEqual ( result , '' )
176- } )
177-
178- it ( 'should handle empty tags array' , ( ) => {
179- const result = serialize ( [ ] )
180-
181- assert . strictEqual ( result , '' )
182- } )
183-
184- it ( 'should handle numeric values' , ( ) => {
185- const tags = [
186- [ 'tag1' , 123 ] ,
187- [ 'tag2' , 456 ]
188- ]
189-
190- const result = serialize ( tags )
191-
192- assert . strictEqual ( result , 'tag1:123,tag2:456' )
193- } )
194-
195- it ( 'should handle mixed defined and undefined values' , ( ) => {
196- const tags = [
197- [ 'tag1' , 'value1' ] ,
198- [ 'tag2' , undefined ] ,
199- [ 'tag3' , 'value3' ] ,
200- [ 'tag4' , undefined ] ,
201- [ 'tag5' , 'value5' ]
202- ]
203-
204- const result = serialize ( tags )
205-
206- assert . strictEqual ( result , 'tag1:value1,tag3:value3,tag5:value5' )
207- } )
208- } )
209-
210128 describe ( 'sanitize' , ( ) => {
211129 it ( 'should convert to lowercase' , ( ) => {
212130 assert . strictEqual ( sanitize ( 'UPPERCASE' ) , 'uppercase' )
0 commit comments