import 'package:block_seasons/services/review_prompt_policy.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  const policy = ReviewPromptPolicy(); // minStagesWon: 5, requiredStars: 3

  test('asks for a review on a 3-star win once enough stages are cleared', () {
    expect(
      policy.shouldRequest(
        alreadyRequested: false,
        won: true,
        stars: 3,
        totalStagesWon: 5,
      ),
      isTrue,
    );
  });

  test('never asks again once a review has been requested', () {
    expect(
      policy.shouldRequest(
        alreadyRequested: true,
        won: true,
        stars: 3,
        totalStagesWon: 20,
      ),
      isFalse,
    );
  });

  test('does not ask after a loss', () {
    expect(
      policy.shouldRequest(
        alreadyRequested: false,
        won: false,
        stars: 0,
        totalStagesWon: 10,
      ),
      isFalse,
    );
  });

  test('does not ask before enough stages are cleared', () {
    expect(
      policy.shouldRequest(
        alreadyRequested: false,
        won: true,
        stars: 3,
        totalStagesWon: 4, // one short of the 5-stage gate
      ),
      isFalse,
    );
  });

  test('does not ask on a win below the star bar (2 stars)', () {
    expect(
      policy.shouldRequest(
        alreadyRequested: false,
        won: true,
        stars: 2,
        totalStagesWon: 10,
      ),
      isFalse,
    );
  });
}
