InstructionAccountNode.test.ts 831 B

1234567891011121314151617181920212223242526272829
  1. import { accountValueNode, instructionAccountNode } from '@kinobi-so/nodes';
  2. import test from 'ava';
  3. import {
  4. deleteNodesVisitorMacro,
  5. getDebugStringVisitorMacro,
  6. identityVisitorMacro,
  7. mergeVisitorMacro,
  8. } from './_setup.js';
  9. const node = instructionAccountNode({
  10. defaultValue: accountValueNode('authority'),
  11. isOptional: false,
  12. isSigner: 'either',
  13. isWritable: true,
  14. name: 'owner',
  15. });
  16. test(mergeVisitorMacro, node, 2);
  17. test(identityVisitorMacro, node);
  18. test(deleteNodesVisitorMacro, node, '[instructionAccountNode]', null);
  19. test(deleteNodesVisitorMacro, node, '[accountValueNode]', instructionAccountNode({ ...node, defaultValue: undefined }));
  20. test(
  21. getDebugStringVisitorMacro,
  22. node,
  23. `
  24. instructionAccountNode [owner.writable.optionalSigner]
  25. | accountValueNode [authority]`,
  26. );