import { beforeEach, describe, expect, it } from 'vitest';
import {
  WALKTHROUGH_SEEN_KEY,
  clearWalkthroughSeen,
  hasSeenWalkthrough,
  markWalkthroughSeen,
  walkthroughSteps,
} from '@/walkthrough/walkthroughConfig';

describe('walkthroughConfig', () => {
  beforeEach(() => {
    localStorage.removeItem(WALKTHROUGH_SEEN_KEY);
  });

  it('starts unseen by default', () => {
    expect(hasSeenWalkthrough()).toBe(false);
  });

  it('marks walkthrough as seen', () => {
    markWalkthroughSeen();
    expect(hasSeenWalkthrough()).toBe(true);
  });

  it('clears walkthrough seen marker', () => {
    markWalkthroughSeen();
    clearWalkthroughSeen();
    expect(hasSeenWalkthrough()).toBe(false);
  });

  it('defines required tour steps and routes', () => {
    expect(walkthroughSteps.length).toBeGreaterThanOrEqual(5);
    expect(walkthroughSteps[0].route).toBe('/dashboard');
    expect(walkthroughSteps.some((step) => step.route.startsWith('/quests'))).toBe(true);
    expect(walkthroughSteps.some((step) => step.route.startsWith('/map'))).toBe(true);
    expect(walkthroughSteps.some((step) => step.route.startsWith('/inventory'))).toBe(true);
  });
});
