import {
  happyUnitChangeStatusTestData,
  happyUnitEditGeneralInfoTestData,
  unhappyUnitChangeStatusTestData,
  unhappyUnitEditGeneralInfoTestData,
  unitEditMeasurementsTestData,
} from '@/manager/modules/unit/data/unit-edit-test-data';
import { test } from '@/manager/modules/unit/unit-fixtures';
import {
  expectUnitGeneralInfoToBeEdited,
  expectUnitGeneralInfoToNotBeEdited,
  expectUnitMeasurementsToBeEdited,
  expectUnitStatusToBeChanged,
  expectUnitStatusToNotBeChanged,
} from '@/manager/modules/unit/utils/unit-edit-expect-utils';

for (const data of happyUnitEditGeneralInfoTestData) {
  test(data.description, async ({ unitListPage }) => {
    await expectUnitGeneralInfoToBeEdited(unitListPage, data.unit, data.changes);
  });
}

for (const data of unhappyUnitEditGeneralInfoTestData) {
  test(data.description, async ({ unitListPage }) => {
    await expectUnitGeneralInfoToNotBeEdited(unitListPage, data.unit, data.changes);
  });
}

for (const data of unitEditMeasurementsTestData) {
  test(data.description, async ({ unitListPage }) => {
    await expectUnitMeasurementsToBeEdited(unitListPage, data.unit, data.changes);
  });
}

for (const data of happyUnitChangeStatusTestData) {
  test(data.description, async ({ unitListPage }) => {
    await expectUnitStatusToBeChanged(unitListPage, data.unit, data.newStatus);
  });
}

for (const data of unhappyUnitChangeStatusTestData) {
  test(data.description, async ({ unitListPage }) => {
    await expectUnitStatusToNotBeChanged(unitListPage, data.unit, data.newStatus);
  });
}
