-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import test from 'ava'; | ||
import { | ||
accountNode, | ||
pdaLinkNode, | ||
pdaNode, | ||
programNode, | ||
visit, | ||
} from '../../../src'; | ||
import { getRenderMapVisitor } from '../../../src/renderers/js-experimental/getRenderMapVisitor'; | ||
import { renderMapContains } from './_setup'; | ||
|
||
test('it renders an empty array seed used on a pda', (t) => { | ||
// Given the following program with 1 account and 1 pda with empty seeds. | ||
const node = programNode({ | ||
name: 'splToken', | ||
publicKey: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', | ||
accounts: [ | ||
accountNode({ | ||
name: 'testAccount', | ||
discriminators: [], | ||
pda: pdaLinkNode('testPda'), | ||
}), | ||
], | ||
pdas: [ | ||
// Empty array seeds. | ||
pdaNode('testPda', []), | ||
], | ||
}); | ||
|
||
// When we render it. | ||
const renderMap = visit(node, getRenderMapVisitor()); | ||
|
||
// Then we expect the following function and and empty seeds | ||
// array used on program derived address function. | ||
renderMapContains(t, renderMap, 'pdas/testPda.ts', [ | ||
/export async function findTestPdaPda/, | ||
/getProgramDerivedAddress\({ programAddress, seeds: \[\] }\)/, | ||
]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters