diff --git a/packages/openapi-ts-tests/main/test/2.0.x.test.ts b/packages/openapi-ts-tests/main/test/2.0.x.test.ts index 9edb12831..916d1645a 100644 --- a/packages/openapi-ts-tests/main/test/2.0.x.test.ts +++ b/packages/openapi-ts-tests/main/test/2.0.x.test.ts @@ -300,7 +300,7 @@ describe(`OpenAPI ${version}`, () => { ); // Deduplicate prefixes: Foo_Foo → Foo const m = clean.match(/^([A-Za-z\d]+)_\1([A-Za-z\d]*)$/); - if (m) clean = m[1] + m[2]; + if (m?.[1] && m?.[2] !== undefined) clean = m[1] + m[2]; return clean; }, }, diff --git a/packages/openapi-ts-tests/main/test/3.0.x.test.ts b/packages/openapi-ts-tests/main/test/3.0.x.test.ts index 22fff3851..b39fcff4e 100644 --- a/packages/openapi-ts-tests/main/test/3.0.x.test.ts +++ b/packages/openapi-ts-tests/main/test/3.0.x.test.ts @@ -603,7 +603,7 @@ describe(`OpenAPI ${version}`, () => { ); // Deduplicate prefixes: Foo_Foo → Foo const m = clean.match(/^([A-Za-z\d]+)_\1([A-Za-z\d]*)$/); - if (m) clean = m[1] + m[2]; + if (m?.[1] && m?.[2] !== undefined) clean = m[1] + m[2]; return clean; }, }, diff --git a/packages/openapi-ts-tests/main/test/3.1.x.test.ts b/packages/openapi-ts-tests/main/test/3.1.x.test.ts index 0ed636eae..2a42d0494 100644 --- a/packages/openapi-ts-tests/main/test/3.1.x.test.ts +++ b/packages/openapi-ts-tests/main/test/3.1.x.test.ts @@ -705,7 +705,7 @@ describe(`OpenAPI ${version}`, () => { ); // Deduplicate prefixes: Foo_Foo → Foo const m = clean.match(/^([A-Za-z\d]+)_\1([A-Za-z\d]*)$/); - if (m) clean = m[1] + m[2]; + if (m?.[1] && m?.[2] !== undefined) clean = m[1] + m[2]; return clean; }, },