@@ -56,11 +56,13 @@ describe('test-id', () => {
5656 it ( 'should add a deterministic UUID to a test without one' , ( ) => {
5757 const test = { ...mockTest }
5858 const result = setTestId ( test )
59-
59+
6060 expect ( result . id ) . toBeDefined ( )
6161 expect ( typeof result . id ) . toBe ( 'string' )
62- expect ( result . id ) . toMatch ( / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - 5 [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } $ / i)
63-
62+ expect ( result . id ) . toMatch (
63+ / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - 5 [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } $ / i
64+ )
65+
6466 const test2 = { ...mockTest }
6567 const result2 = setTestId ( test2 )
6668 expect ( result . id ) . toBe ( result2 . id )
@@ -69,7 +71,7 @@ describe('test-id', () => {
6971 it ( 'should not overwrite existing ID' , ( ) => {
7072 const test = { ...mockTest , id : 'existing-id' }
7173 const result = setTestId ( test )
72-
74+
7375 expect ( result . id ) . toBe ( 'existing-id' )
7476 } )
7577 } )
@@ -78,19 +80,21 @@ describe('test-id', () => {
7880 it ( 'should return existing ID' , ( ) => {
7981 const test = { ...mockTest , id : 'existing-id' }
8082 const result = getTestId ( test )
81-
83+
8284 expect ( result ) . toBe ( 'existing-id' )
8385 } )
8486
8587 it ( 'should generate and return deterministic UUID if none exists' , ( ) => {
8688 const test = { ...mockTest }
8789 const result = getTestId ( test )
88-
90+
8991 expect ( result ) . toBeDefined ( )
9092 expect ( typeof result ) . toBe ( 'string' )
91- expect ( result ) . toMatch ( / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - 5 [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } $ / i)
92- expect ( test . id ) . toBe ( result )
93-
93+ expect ( result ) . toMatch (
94+ / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - 5 [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } $ / i
95+ )
96+ expect ( test . id ) . toBe ( result )
97+
9498 const test2 = { ...mockTest }
9599 const result2 = getTestId ( test2 )
96100 expect ( result ) . toBe ( result2 )
@@ -99,9 +103,9 @@ describe('test-id', () => {
99103
100104 describe ( 'setTestIdsForReport' , ( ) => {
101105 it ( 'should set IDs for all tests in a report' , ( ) => {
102- const report = JSON . parse ( JSON . stringify ( mockReport ) )
106+ const report = JSON . parse ( JSON . stringify ( mockReport ) )
103107 const result = setTestIdsForReport ( report )
104-
108+
105109 expect ( result . results . tests ) . toHaveLength ( 2 )
106110 expect ( result . results . tests [ 0 ] . id ) . toBeDefined ( )
107111 expect ( result . results . tests [ 1 ] . id ) . toBeDefined ( )
@@ -111,9 +115,9 @@ describe('test-id', () => {
111115 it ( 'should not overwrite existing IDs' , ( ) => {
112116 const report = JSON . parse ( JSON . stringify ( mockReport ) )
113117 report . results . tests [ 0 ] . id = 'existing-id'
114-
118+
115119 const result = setTestIdsForReport ( report )
116-
120+
117121 expect ( result . results . tests [ 0 ] . id ) . toBe ( 'existing-id' )
118122 expect ( result . results . tests [ 1 ] . id ) . toBeDefined ( )
119123 expect ( result . results . tests [ 1 ] . id ) . not . toBe ( 'existing-id' )
@@ -125,18 +129,18 @@ describe('test-id', () => {
125129 const report = JSON . parse ( JSON . stringify ( mockReport ) )
126130 report . results . tests [ 0 ] . id = 'test-id-1'
127131 report . results . tests [ 1 ] . id = 'test-id-2'
128-
132+
129133 const result = findTestById ( report , 'test-id-1' )
130-
134+
131135 expect ( result ) . toBeDefined ( )
132136 expect ( result ?. name ) . toBe ( 'test 1' )
133137 } )
134138
135139 it ( 'should return undefined for non-existent ID' , ( ) => {
136140 const report = JSON . parse ( JSON . stringify ( mockReport ) )
137-
141+
138142 const result = findTestById ( report , 'non-existent-id' )
139-
143+
140144 expect ( result ) . toBeUndefined ( )
141145 } )
142146 } )
@@ -148,11 +152,13 @@ describe('test-id', () => {
148152 [ 'suite1' , 'suite2' ] ,
149153 'test.ts'
150154 )
151-
155+
152156 expect ( result ) . toBeDefined ( )
153157 expect ( typeof result ) . toBe ( 'string' )
154- expect ( result ) . toMatch ( / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - 5 [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } $ / i)
155-
158+ expect ( result ) . toMatch (
159+ / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - 5 [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } $ / i
160+ )
161+
156162 const result2 = generateTestIdFromProperties (
157163 'test name' ,
158164 [ 'suite1' , 'suite2' ] ,
@@ -163,16 +169,26 @@ describe('test-id', () => {
163169
164170 it ( 'should handle missing optional parameters' , ( ) => {
165171 const result = generateTestIdFromProperties ( 'test name' )
166-
172+
167173 expect ( result ) . toBeDefined ( )
168174 expect ( typeof result ) . toBe ( 'string' )
169- expect ( result ) . toMatch ( / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - 5 [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } $ / i)
175+ expect ( result ) . toMatch (
176+ / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - 5 [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } $ / i
177+ )
170178 } )
171179
172180 it ( 'should generate different UUIDs for different properties' , ( ) => {
173- const result1 = generateTestIdFromProperties ( 'test1' , [ 'suite1' ] , 'file1.ts' )
174- const result2 = generateTestIdFromProperties ( 'test2' , [ 'suite2' ] , 'file2.ts' )
175-
181+ const result1 = generateTestIdFromProperties (
182+ 'test1' ,
183+ [ 'suite1' ] ,
184+ 'file1.ts'
185+ )
186+ const result2 = generateTestIdFromProperties (
187+ 'test2' ,
188+ [ 'suite2' ] ,
189+ 'file2.ts'
190+ )
191+
176192 expect ( result1 ) . not . toBe ( result2 )
177193 } )
178194 } )
@@ -181,11 +197,13 @@ describe('test-id', () => {
181197 it ( 'should be a valid UUID' , ( ) => {
182198 expect ( CTRF_NAMESPACE ) . toBeDefined ( )
183199 expect ( typeof CTRF_NAMESPACE ) . toBe ( 'string' )
184- expect ( CTRF_NAMESPACE ) . toMatch ( / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 12 } $ / i)
200+ expect ( CTRF_NAMESPACE ) . toMatch (
201+ / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 12 } $ / i
202+ )
185203 } )
186204
187205 it ( 'should be stable and not change' , ( ) => {
188206 expect ( CTRF_NAMESPACE ) . toBe ( '6ba7b810-9dad-11d1-80b4-00c04fd430c8' )
189207 } )
190208 } )
191- } )
209+ } )
0 commit comments