@@ -4,28 +4,40 @@ import test from 'node:test';
44import { hasInvalidPingCopyrightHeader , updateCopyrightYears } from './sync-header-years.mjs' ;
55
66test ( 'updates stale range end year and keeps start year' , ( ) => {
7- const input = '/* Copyright 2020- 2026 Ping Identity. All Rights Reserved */' ;
7+ const input = '/* Copyright 2020 - 2026 Ping Identity. All Rights Reserved */' ;
88 const actual = updateCopyrightYears ( input , 2026 ) ;
9- assert . equal ( actual , '/* Copyright 2020- 2026 Ping Identity. All Rights Reserved */' ) ;
9+ assert . equal ( actual , '/* Copyright 2020 - 2026 Ping Identity. All Rights Reserved */' ) ;
1010} ) ;
1111
12- test ( 'updates stale single year to a range preserving start year' , ( ) => {
12+ test ( 'normalizes separator on an already-current range' , ( ) => {
13+ const input = '/* Copyright 2020 - 2026 Ping Identity. All Rights Reserved */' ;
14+ const actual = updateCopyrightYears ( input , 2026 ) ;
15+ assert . equal ( actual , '/* Copyright 2020 - 2026 Ping Identity. All Rights Reserved */' ) ;
16+ } ) ;
17+
18+ test ( 'expands stale single year to a range preserving start year' , ( ) => {
19+ const input = '/* Copyright 2020 - 2026 Ping Identity. All Rights Reserved */' ;
20+ const actual = updateCopyrightYears ( input , 2026 ) ;
21+ assert . equal ( actual , '/* Copyright 2020 - 2026 Ping Identity. All Rights Reserved */' ) ;
22+ } ) ;
23+
24+ test ( 'does not change an already-current spaced range' , ( ) => {
1325 const input = '/* Copyright 2025 - 2026 Ping Identity. All Rights Reserved */' ;
1426 const actual = updateCopyrightYears ( input , 2026 ) ;
15- assert . equal ( actual , '/* Copyright 2025 - 2026 Ping Identity. All Rights Reserved */' ) ;
27+ assert . equal ( actual , input ) ;
1628} ) ;
1729
1830test ( 'supports © and © variants' , ( ) => {
1931 const input = [
20- '/* © Copyright 2020- 2026 Ping Identity. */' ,
21- '<!-- © Copyright 2020- 2026 Ping Identity. -->' ,
32+ '/* © Copyright 2020 - 2026 Ping Identity. */' ,
33+ '<!-- © Copyright 2020 - 2026 Ping Identity. -->' ,
2234 ] . join ( '\n' ) ;
2335 const actual = updateCopyrightYears ( input , 2026 ) ;
2436 assert . equal (
2537 actual ,
2638 [
27- '/* © Copyright 2020- 2026 Ping Identity. */' ,
28- '<!-- © Copyright 2020- 2026 Ping Identity. -->' ,
39+ '/* © Copyright 2020 - 2026 Ping Identity. */' ,
40+ '<!-- © Copyright 2020 - 2026 Ping Identity. -->' ,
2941 ] . join ( '\n' ) ,
3042 ) ;
3143} ) ;
@@ -45,12 +57,12 @@ test('updates Ping Identity Corporation ranges with spaces and (c)', () => {
4557 ) ;
4658} ) ;
4759
48- test ( 'updates Ping Identity Corporation stale single year with (c) to range' , ( ) => {
49- const input = '/* Copyright (c) 2025 - 2026 Ping Identity Corporation. All right reserved. */' ;
60+ test ( 'expands stale single year with (c) to a range for Ping Identity Corporation ' , ( ) => {
61+ const input = '/* Copyright (c) 2023 - 2026 Ping Identity Corporation. All right reserved. */' ;
5062 const actual = updateCopyrightYears ( input , 2026 ) ;
5163 assert . equal (
5264 actual ,
53- '/* Copyright (c) 2025 - 2026 Ping Identity Corporation. All right reserved. */' ,
65+ '/* Copyright (c) 2023 - 2026 Ping Identity Corporation. All right reserved. */' ,
5466 ) ;
5567} ) ;
5668
0 commit comments