Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

1.7 KB
Raw Blame
import { describe, expect, it } from 'vitest';

import { buildSelfHostedCommercialPlanModel } from '../commercialBillingModel';
import { SELF_HOSTED_PLAN_BY_TIER } from '../selfHostedPlans';

const createBaseInput = () => ({
  licensedEmail: '[email protected]',
  statusLabel: 'Active',
  tierLabel: 'Pro',
  planTerms: 'Pro Monthly',
  expires: '12/31/2026',
  daysRemaining: 123,
});

describe('commercialBillingModel', () => {
  it('uses shared current retail plan metadata without capacity entitlement copy', () => {
    const model = buildSelfHostedCommercialPlanModel({
      ...createBaseInput(),
      retailPlanDefinition: SELF_HOSTED_PLAN_BY_TIER.pro,
    });

    expect(model.summary).toEqual([
      { label: 'Core Monitoring', value: 'Included' },
      { label: 'Metric History', value: '90 days' },
      { label: 'Included Extras', value: 'Patrol modes, history, and team controls' },
    ]);
    expect(model.details.map((item) => item.label)).toEqual([
      'Tier',
      'Licensed Email',
      'Plan Terms',
      'Expires',
      'Days Remaining',
    ]);
  });

  it('keeps grandfathered continuity focused on unmetered core monitoring', () => {
    const model = buildSelfHostedCommercialPlanModel({
      ...createBaseInput(),
      planTerms: 'V5 Pro Monthly (Grandfathered)',
      retailPlanDefinition: null,
    });

    expect(model.summary).toEqual([
      { label: 'Core Monitoring', value: 'Included' },
      { label: 'Plan Status', value: 'Active' },
    ]);
    expect(model.details.map((item) => item.label)).not.toContain('Included Monitored Systems');
    expect(model.summary.map((item) => item.label)).not.toContain('Guest Capacity');
    expect(JSON.stringify(model)).not.toContain('Unlimited');
  });
});