import { beforeEach, describe, expect, it } from 'vitest';
import { getSelectedPackageId, setSelectedPackageId } from './onboardingSelection';

describe('onboardingSelection', () => {
  beforeEach(() => {
    if (typeof window !== 'undefined') {
      window.localStorage.clear();
    }
  });

  it('stores and returns the selected package id', () => {
    setSelectedPackageId(12);
    expect(getSelectedPackageId()).toBe(12);
  });

  it('clears the selection when set to null', () => {
    setSelectedPackageId(3);
    setSelectedPackageId(null);
    expect(getSelectedPackageId()).toBeNull();
  });
});
