package com.ruoyi.web.modules.architecture.support;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

@DisplayName("WithdrawalPeriodStandardRules")
class WithdrawalPeriodStandardRulesTest
{

    @Test
    @DisplayName("合法 kb 状态")
    void validKb()
    {
        assertTrue(WithdrawalPeriodStandardRules.isValidKbSyncStatus(0));
        assertTrue(WithdrawalPeriodStandardRules.isValidKbSyncStatus(1));
        assertFalse(WithdrawalPeriodStandardRules.isValidKbSyncStatus(null));
        assertFalse(WithdrawalPeriodStandardRules.isValidKbSyncStatus(2));
    }

    @Test
    @DisplayName("编辑/删除/同步仅未同步")
    void unsyncedOnly()
    {
        assertTrue(WithdrawalPeriodStandardRules.canEdit(0));
        assertFalse(WithdrawalPeriodStandardRules.canEdit(1));
        assertFalse(WithdrawalPeriodStandardRules.canEdit(null));

        assertTrue(WithdrawalPeriodStandardRules.canDelete(0));
        assertFalse(WithdrawalPeriodStandardRules.canDelete(1));

        assertTrue(WithdrawalPeriodStandardRules.canSyncKb(0));
        assertFalse(WithdrawalPeriodStandardRules.canSyncKb(1));
    }

    @Test
    @DisplayName("移出仅已同步")
    void removeOnlySynced()
    {
        assertTrue(WithdrawalPeriodStandardRules.canRemoveKb(1));
        assertFalse(WithdrawalPeriodStandardRules.canRemoveKb(0));
        assertFalse(WithdrawalPeriodStandardRules.canRemoveKb(null));
    }
}
