import { test, expect } from 'bun:test';
import { getUserFavList, updateUserFav, isUserFav, deleteUserFav } from '../src/dao/FavPlayerDAO';

test('Test fav', async () => {
  await updateUserFav('aud1', 'uid1');
  await updateUserFav('aud1', 'uid2');
  expect((await getUserFavList('aud1')).length).toBe(2);
  expect(await isUserFav('aud1', 'uid1')).toBeTrue();
  expect(await isUserFav('aud1', 'uid2')).toBeTrue();
  await deleteUserFav('aud1', 'uid1');
  await deleteUserFav('aud1', 'uid2');
});

test("Test unFave", async () => {
  await updateUserFav('aud1', 'uid3');
  expect(await isUserFav('aud1', 'uid3')).toBeTrue();
  await deleteUserFav('aud1', 'uid3');
  expect(await isUserFav('aud1', 'uid3')).toBeFalse();
});