import { groupLineStickers } from '../utils';
import {
  emptyInputs,
  noValidPackageIdsInput,
  singleCategoryInput,
  multipleCategoriesInput,
  nonArrayCategoriesInput,
  mixedStickerDataInput
} from './mockData';

describe('groupLineStickers', () => {
  it.concurrent('should return empty object when input is empty', () => {
    expect(groupLineStickers(emptyInputs.emptyObject)).toEqual(emptyInputs.expectedOutput);
    expect(groupLineStickers(emptyInputs.nullInput)).toEqual(emptyInputs.expectedOutput);
    expect(groupLineStickers(emptyInputs.undefinedInput)).toEqual(emptyInputs.expectedOutput);
  });

  it.concurrent('should handle input with no valid packageIds', () => {
    expect(groupLineStickers(noValidPackageIdsInput.input)).toEqual(noValidPackageIdsInput.expectedOutput);
  });

  it.concurrent('should group stickers by packageId within single category', () => {
    expect(groupLineStickers(singleCategoryInput.input)).toEqual(singleCategoryInput.expectedOutput);
  });

  it.concurrent('should group stickers by packageId across multiple categories', () => {
    expect(groupLineStickers(multipleCategoriesInput.input)).toEqual(multipleCategoriesInput.expectedOutput);
  });

  it.concurrent('should skip non-array categories', () => {
    expect(groupLineStickers(nonArrayCategoriesInput.input)).toEqual(nonArrayCategoriesInput.expectedOutput);
  });

  it.concurrent('should handle mixed valid and invalid sticker data', () => {
    expect(groupLineStickers(mixedStickerDataInput.input)).toEqual(mixedStickerDataInput.expectedOutput);
  });
}); 