|
| 1 | +/** |
| 2 | + * Copyright 2026 GitProxy Contributors |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +import { describe, it, expect } from 'vitest'; |
| 18 | +import { getDeprecatedConfigWarnings } from '../src/config/deprecatedFields'; |
| 19 | + |
| 20 | +describe('getDeprecatedConfigWarnings', () => { |
| 21 | + it('returns warnings for legacy TLS-only user config', () => { |
| 22 | + const warnings = getDeprecatedConfigWarnings({ |
| 23 | + sslKeyPemPath: 'key.pem', |
| 24 | + sslCertPemPath: 'cert.pem', |
| 25 | + }); |
| 26 | + |
| 27 | + expect(warnings).toHaveLength(2); |
| 28 | + expect(warnings).toContain( |
| 29 | + '"sslKeyPemPath" is deprecated; use "tls.key" instead (removal in GitProxy 3.0)', |
| 30 | + ); |
| 31 | + expect(warnings).toContain( |
| 32 | + '"sslCertPemPath" is deprecated; use "tls.cert" instead (removal in GitProxy 3.0)', |
| 33 | + ); |
| 34 | + }); |
| 35 | + |
| 36 | + it('returns no warnings for non-deprecated overrides', () => { |
| 37 | + expect(getDeprecatedConfigWarnings({ uiPort: 9000 })).toEqual([]); |
| 38 | + expect( |
| 39 | + getDeprecatedConfigWarnings({ |
| 40 | + tls: { enabled: true, key: 'k.pem', cert: 'c.pem' }, |
| 41 | + }), |
| 42 | + ).toEqual([]); |
| 43 | + }); |
| 44 | +}); |
0 commit comments