From bcc29ddfab0ec8cacc9419ac25dea378f7a8757e Mon Sep 17 00:00:00 2001 From: Denis Ah-Kang Date: Mon, 6 Jan 2025 18:07:20 +0400 Subject: [PATCH] make tests independant of the year --- test/doc-views/TR/Recommendation/REC.js | 3 +-- test/doc-views/TR/Registry/CRY.js | 6 +++--- test/doc-views/TR/TRBase.js | 12 ++++++------ test/doc-views/layout/spec.handlebars | 8 ++++---- test/doc-views/specBase.js | 6 ++++-- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/test/doc-views/TR/Recommendation/REC.js b/test/doc-views/TR/Recommendation/REC.js index 344cd6366..0601a620e 100644 --- a/test/doc-views/TR/Recommendation/REC.js +++ b/test/doc-views/TR/Recommendation/REC.js @@ -126,8 +126,7 @@ export default { ...good.sotd.rec, showProposedAdd: true, }, - processHTML: - '2 November 2024, 3 November 2024 W3C Process Document', + processHTML: `2 November ${currentYear}, 3 November ${currentYear} W3C Process Document`, }, }, notFound: { diff --git a/test/doc-views/TR/Registry/CRY.js b/test/doc-views/TR/Registry/CRY.js index 86add3736..8b1356868 100644 --- a/test/doc-views/TR/Registry/CRY.js +++ b/test/doc-views/TR/Registry/CRY.js @@ -2,6 +2,7 @@ import { config } from '../../../../lib/profiles/TR/Registry/CRY.js'; import registryBase from './registryBase.js'; const { buildCommonViewData, data } = registryBase; +const currentYear = new Date().getFullYear(); const profile = 'CRY'; const customData = { @@ -28,15 +29,14 @@ export default { ...good, header: { ...good.header, - defaultDate: '04 November 2025', + defaultDate: `04 November ${currentYear}`, }, }, multipleDateFound: { ...good, sotd: { ...good.sotd, - processHTML: - '04 October 2024. 05 October 2024.W3C Process Document', + processHTML: `04 October ${currentYear}. 05 October ${currentYear}.W3C Process Document`, }, }, invalidDate: { diff --git a/test/doc-views/TR/TRBase.js b/test/doc-views/TR/TRBase.js index 6920578d0..26bc5d276 100644 --- a/test/doc-views/TR/TRBase.js +++ b/test/doc-views/TR/TRBase.js @@ -5,6 +5,8 @@ import { export { data }; +const currentYear = new Date().getFullYear(); + export function buildCommonViewData(base) { const common = _buildCommonViewData(base); return { @@ -75,8 +77,7 @@ export function buildCommonViewData(base) { copyright: { ...base.copyright, showDefault: false, - exceptionHtml: - 'Copyright © 1999-2024 International Digital Publishing Forum and World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply.', + exceptionHtml: `Copyright © 1999-${currentYear} International Digital Publishing Forum and World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply.`, }, }, copyrightExceptionNotFound: { @@ -93,8 +94,7 @@ export function buildCommonViewData(base) { copyright: { ...base.copyright, showDefault: false, - exceptionHtml: - 'Copyright Exception Not Found © 1999-2024 International Digital Publishing Forum and World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply.', + exceptionHtml: `Copyright Exception Not Found © 1999-${currentYear} International Digital Publishing Forum and World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply.`, }, }, }, @@ -255,14 +255,14 @@ export function buildCandidateReviewEnd(base) { ...base, sotd: { ...base.sotd, - defaultCRDate: '04 October 2024. 05 October 2024.', + defaultCRDate: `04 November ${currentYear}. 05 November ${currentYear}.`, }, }, invalidDate: { ...base, sotd: { ...base.sotd, - defaultCRDate: '02 October 2025', + defaultCRDate: '02 October 2030', }, }, }; diff --git a/test/doc-views/layout/spec.handlebars b/test/doc-views/layout/spec.handlebars index 7d8887f2c..54016f978 100644 --- a/test/doc-views/layout/spec.handlebars +++ b/test/doc-views/layout/spec.handlebars @@ -36,8 +36,8 @@ {{/if}}

- W3C {{config.longStatus}} {{config.crType}} {{config.cryType}} {{! if document is Echidna, use current date. else, use default date}} + W3C {{config.longStatus}} {{config.crType}} {{config.cryType}}

{{dl.thisVersion.text}}
- - https://www.w3.org/{{dl.topLevel}}/{{#if config.isEchidna}}{{nowYear}}{{else}}2024{{/if}}/{{config.status}}-{{dl.shortName}}-{{! if document is Echidna, use current date. else, use default date}}{{#if config.isEchidna}}{{nowDigit8}}{{else}}20240804{{/if}}/ + + https://www.w3.org/{{dl.topLevel}}/{{nowYear}}/{{config.status}}-{{dl.shortName}}-{{! if document is Echidna, use current date. else, use default date}}{{#if config.isEchidna}}{{nowDigit8}}{{else}}{{nowYear}}0804{{/if}}/
{{/if}} @@ -226,7 +226,7 @@ {{#config.isCRY}}

- This Candidate Registry is not expected to advance to Registry any earlier than 6 June 2025. + This Candidate Registry is not expected to advance to Registry any earlier than 6 September 2025.

{{/config.isCRY}} diff --git a/test/doc-views/specBase.js b/test/doc-views/specBase.js index b4ad6ba10..b701dcab2 100644 --- a/test/doc-views/specBase.js +++ b/test/doc-views/specBase.js @@ -1,3 +1,5 @@ +const currentYear = new Date().getFullYear(); + export const data = { bodyClassNames: 'h-entry', scripts: ['https://www.w3.org/scripts/TR/2021/fixup.js'], @@ -38,7 +40,7 @@ export const data = { show: true, text: 'More details about this document', }, - defaultDate: '04 August 2024', + defaultDate: `04 August ${currentYear}`, showDefaultDate: false, }, secno: 'secno', @@ -192,7 +194,7 @@ export const data = { show: false, text: 'Future updates to this Recommendation may incorporate new features.', }, - defaultCRDate: '04 October 2024', + defaultCRDate: `04 October ${currentYear}`, rec: { showProposedAdd: false, showAddition: false,