@@ -17,7 +17,7 @@ import { visit } from '@codama/visitors-core';
1717import { test } from 'vitest' ;
1818
1919import { getRenderMapVisitor } from '../src' ;
20- import { codeContains } from './_setup' ;
20+ import { codeContains , codeDoesNotContains } from './_setup' ;
2121
2222test ( 'it renders a byte array seed used on an account' , ( ) => {
2323 // Given the following program with 1 account and 1 pda with a byte array as seeds.
@@ -134,3 +134,33 @@ test('it renders anchor traits impl', () => {
134134 'impl anchor_lang::Owner for TestAccount' ,
135135 ] ) ;
136136} ) ;
137+
138+ test ( 'it renders account without anchor traits' , ( ) => {
139+ // Given the following account.
140+ const node = programNode ( {
141+ accounts : [
142+ accountNode ( {
143+ discriminators : [
144+ {
145+ kind : 'fieldDiscriminatorNode' ,
146+ name : camelCase ( 'discriminator' ) ,
147+ offset : 0 ,
148+ } ,
149+ ] ,
150+ name : 'testAccount' ,
151+ pda : pdaLinkNode ( 'testPda' ) ,
152+ } ) ,
153+ ] ,
154+ name : 'myProgram' ,
155+ publicKey : '1111' ,
156+ } ) ;
157+
158+ // When we render it with anchor traits disabled.
159+ const renderMap = visit ( node , getRenderMapVisitor ( { anchorTraits : false } ) ) ;
160+
161+ // Then we do not expect Anchor traits.
162+ codeDoesNotContains ( renderMap . get ( 'accounts/test_account.rs' ) , [
163+ '#[cfg(feature = "anchor")]' ,
164+ '#[cfg(feature = "anchor-idl-build")]' ,
165+ ] ) ;
166+ } ) ;
0 commit comments