Skip to content

fix(billing): subscriptions test hardcodes plan: 'starter' — breaks plan-renamed downstream #4064

Description

@PierreBrisorgueil

Problem

The new tests added in PR #4063 to src/modules/billing/tests/billing.subscriptions.component.unit.tests.js hardcode plan: 'starter' in the fixture for the new "Change Plan" CTA suite (status and paid plan CTAs describe block).

This breaks any downstream project that overrides billing.static-content.plans with their own plan IDs. Example: trawl_vue overrides plans to free / growth / pro, so availablePlanIds.indexOf('starter') returns -1, canUpgrade is false, and the test asserting "Change Plan" fails.

FAIL  src/modules/billing/tests/billing.subscriptions.component.unit.tests.js > BillingSubscriptionsComponent — status and paid plan CTAs > labels the paid plan upgrade CTA as Change Plan when a higher plan exists
AssertionError: expected 'Current PlanStatus:active Next billin…' to contain 'Change Plan'

Expected: "Change Plan"
Received: "Current PlanStatus:active Next billing date: May 3, 2026 Manage Subscription"

Affected file(s)

  • src/modules/billing/tests/billing.subscriptions.component.unit.tests.js — two new tests in the "status and paid plan CTAs" describe block use plan: 'starter' (line ~343) and plan: 'pro' (line ~351). The 'pro' line happens to work because trawl also has 'pro' as the highest tier, but it's coincidental.

Steps to reproduce

cd trawl_vue
git fetch devkit-vue
git merge devkit-vue/master
NODE_ENV=trawl npm run test:unit -- src/modules/billing/tests/billing.subscriptions.component.unit.tests.js
# 1 failure

Suggested fix

Derive plan IDs dynamically from plansConfig so tests are portable to any plan rename. Already applied locally on trawl_vue — happy to PR upstream:

import { plans as plansConfig } from '../config/billing.static-content';

const paidPlanWithHigher = plansConfig
  .map((p) => p.id || p.planId)
  .filter(Boolean)
  .find((id, idx, arr) => id !== 'free' && idx < arr.length - 1) || 'starter';
const highestPlan = plansConfig
  .map((p) => p.id || p.planId)
  .filter(Boolean)
  .at(-1) || 'pro';

Then use paidPlanWithHigher and highestPlan in the new test fixtures.

Context

Found during /update-stack on trawl_vue (PR absorbing devkit Vue #4062 + #4063).
Per feedback_update_stack_theirs_wipes_patches, this kind of stack-coupled
test data drift is the recurring sharp edge — pushing the fix upstream
removes a permanent merge friction.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions