Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 9 additions & 51 deletions scripts/verify-angular-support.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import {
ANGULAR_PEER_RANGE,
SUPPORTED_ANGULAR_MAJORS,
} from '../examples/chat/smoke/angular-versions.mjs';
import {
WEBSITE_ANGULAR_SUPPORT_ROWS,
WEBSITE_PRICING_SUPPORT_SUMMARY,
WEBSITE_SUPPORTED_ANGULAR_MAJORS,
} from '../apps/website/src/components/pricing/angular-support.mjs';
import { WEBSITE_SUPPORTED_ANGULAR_MAJORS } from '../apps/website/src/components/pricing/angular-support.mjs';

export { ANGULAR_PEER_RANGE };

Expand Down Expand Up @@ -248,19 +244,20 @@ export async function verifyDocumentation({ root = process.cwd() } = {}) {
}
}

/**
* The pricing page's Angular compatibility matrix and support summary were
* removed in #908, taking WEBSITE_ANGULAR_SUPPORT_ROWS and
* WEBSITE_PRICING_SUPPORT_SUMMARY with them. The row/summary assertions that
* used to live here verified copy that no longer renders anywhere, so they are
* gone too. WEBSITE_SUPPORTED_ANGULAR_MAJORS still backs live page content and
* is still checked against the registry.
*/
export async function verifyWebsiteMajors({
websiteAngularSupportRows = WEBSITE_ANGULAR_SUPPORT_ROWS,
websitePricingSupportSummary = WEBSITE_PRICING_SUPPORT_SUMMARY,
websiteSupportedAngularMajors = WEBSITE_SUPPORTED_ANGULAR_MAJORS,
} = {}) {
const errors = [];
const expectedMajors = SUPPORTED_ANGULAR_MAJORS.join(', ');
const actualMajors = websiteSupportedAngularMajors.join(', ');
const expectedSupportedVersions = `Angular ${expectedMajors}`;
const expectedPricingSupportSummary = `Angular ${SUPPORTED_ANGULAR_MAJORS.slice(
0,
-1
).join(', ')}, and ${SUPPORTED_ANGULAR_MAJORS.at(-1)} support`;

if (
websiteSupportedAngularMajors.length !== SUPPORTED_ANGULAR_MAJORS.length ||
Expand All @@ -273,45 +270,6 @@ export async function verifyWebsiteMajors({
);
}

const supportedRows = websiteAngularSupportRows.filter(
(row) => row.label === 'Supported'
);
const plannedRows = websiteAngularSupportRows.filter(
(row) => row.label === 'Planned'
);

if (supportedRows.length !== 1) {
errors.push(
`website must contain exactly one Supported row but found ${supportedRows.length}.`
);
} else if (supportedRows[0].versions !== expectedSupportedVersions) {
errors.push(
`website Supported row versions expected "${expectedSupportedVersions}" but found "${supportedRows[0].versions}".`
);
}

if (plannedRows.length !== 1) {
errors.push(
`website must contain exactly one Planned row but found ${plannedRows.length}.`
);
}

if (websitePricingSupportSummary !== expectedPricingSupportSummary) {
errors.push(
`website pricing support summary expected "${expectedPricingSupportSummary}" but found "${websitePricingSupportSummary}".`
);
}

for (const plannedRow of plannedRows) {
for (const major of SUPPORTED_ANGULAR_MAJORS) {
if (new RegExp(`\\b${major}\\b`).test(plannedRow.versions)) {
errors.push(
`website Planned row must not contain supported Angular major ${major}.`
);
}
}
}

if (errors.length > 0) {
throw new Error(errors.join('\n'));
}
Expand Down
110 changes: 2 additions & 108 deletions scripts/verify-angular-support.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,8 @@ function runNode(args) {
});
}

function createWebsiteFixture({
supportedMajors = [20, 21, 22],
supportedVersions = 'Angular 20, 21, 22',
plannedVersions = '—',
pricingSupportSummary = 'Angular 20, 21, and 22 support',
} = {}) {
return {
websiteAngularSupportRows: [
{
label: 'Supported',
versions: supportedVersions,
tone: 'success',
},
{ label: 'Experimental', versions: '—', tone: 'warn' },
{ label: 'Planned', versions: plannedVersions, tone: 'info' },
{ label: 'Unsupported', versions: 'Angular ≤19', tone: 'muted' },
],
websiteSupportedAngularMajors: supportedMajors,
websitePricingSupportSummary: pricingSupportSummary,
};
function createWebsiteFixture({ supportedMajors = [20, 21, 22] } = {}) {
return { websiteSupportedAngularMajors: supportedMajors };
}

async function createDocumentationFixture(t, updateDocumentation) {
Expand Down Expand Up @@ -248,94 +230,6 @@ test('reports website support data that advertises Angular 23', async () => {
);
});

test('reports a supported Angular major under the website Planned row', async () => {
await assert.rejects(
verifyWebsiteMajors(
createWebsiteFixture({ plannedVersions: 'Angular 22' })
),
/website Planned row must not contain supported Angular major 22/
);
});

test('reports Supported row text that omits Angular 22', async () => {
await assert.rejects(
verifyWebsiteMajors(
createWebsiteFixture({ supportedVersions: 'Angular 20, 21' })
),
/website Supported row versions expected "Angular 20, 21, 22" but found "Angular 20, 21"/
);
});

test('reports Supported row text that advertises Angular 23', async () => {
await assert.rejects(
verifyWebsiteMajors(
createWebsiteFixture({ supportedVersions: 'Angular 20, 21, 22, 23' })
),
/website Supported row versions expected "Angular 20, 21, 22" but found "Angular 20, 21, 22, 23"/
);
});

test('reports a missing website Supported row', async () => {
const fixture = createWebsiteFixture();
fixture.websiteAngularSupportRows = fixture.websiteAngularSupportRows.filter(
(row) => row.label !== 'Supported'
);

await assert.rejects(
verifyWebsiteMajors(fixture),
/website must contain exactly one Supported row but found 0/
);
});

test('reports duplicate website Supported rows', async () => {
const fixture = createWebsiteFixture();
fixture.websiteAngularSupportRows = [
...fixture.websiteAngularSupportRows,
{ label: 'Supported', versions: 'Angular 20, 21, 22', tone: 'success' },
];

await assert.rejects(
verifyWebsiteMajors(fixture),
/website must contain exactly one Supported row but found 2/
);
});

test('reports a missing website Planned row', async () => {
const fixture = createWebsiteFixture();
fixture.websiteAngularSupportRows = fixture.websiteAngularSupportRows.filter(
(row) => row.label !== 'Planned'
);

await assert.rejects(
verifyWebsiteMajors(fixture),
/website must contain exactly one Planned row but found 0/
);
});

test('reports duplicate website Planned rows', async () => {
const fixture = createWebsiteFixture();
fixture.websiteAngularSupportRows = [
...fixture.websiteAngularSupportRows,
{ label: 'Planned', versions: '—', tone: 'info' },
];

await assert.rejects(
verifyWebsiteMajors(fixture),
/website must contain exactly one Planned row but found 2/
);
});

test('reports a pricing support summary that drifts from website majors', async () => {
await assert.rejects(
verifyWebsiteMajors(
createWebsiteFixture({
pricingSupportSummary: 'Angular 20 and 21 support',
})
),
/website pricing support summary expected "Angular 20, 21, and 22 support" but found "Angular 20 and 21 support"/
);
});

test('reports a peer range that omits Angular 22', async (t) => {
const root = await createFixture(t, async (fixtureRoot) => {
await writeJson(join(fixtureRoot, 'libs/chat/package.json'), {
Expand Down
Loading