@avalabs/avalanchejs
Version:
Avalanche Platform JS Library
66 lines (61 loc) • 2.3 kB
text/typescript
import { TypeSymbols } from '../constants';
import { describe, test, expect } from 'vitest';
import { onlyChecksOneGuard } from '../../fixtures/utils/typeguards';
import {
isImportTx,
isExportTx,
isAddSubnetValidatorTx,
isAddPermissionlessValidatorTx,
isAddValidatorTx,
isAddDelegatorTx,
isAddPermissionlessDelegatorTx,
isCreateSubnetTx,
isCreateChainTx,
isAdvanceTimeTx,
isEmptySigner,
isSigner,
isRewardValidatorTx,
isRemoveSubnetValidatorTx,
isPvmBaseTx,
isTransferSubnetOwnershipTx,
isTransformSubnetTx,
isConvertSubnetToL1Tx,
isIncreaseL1ValidatorBalanceTx,
isDisableL1ValidatorTx,
isSetL1ValidatorWeightTx,
isRegisterL1ValidatorTx,
} from './typeGuards';
const cases: [any, TypeSymbols][] = [
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
];
const guards = cases.map((caseItem) => caseItem[0]);
describe('pvm/typeGuards', function () {
test.each(cases)('%p to pass', (guard, type) => {
const object = {
_type: type,
};
expect(guard(object)).toBe(true);
expect(onlyChecksOneGuard(object, guards)).toBe(true);
});
});