selling-view.test.ts (848B)
1 import { expect, test } from 'vitest'; 2 import { 3 openSellingView, 4 sellingViewSnapshot, 5 closeSellingView 6 } from '../../src/lib/publishing/selling-view.ts'; 7 import type { IdentityViewContext } from '../../src/lib/runtime/view-context.ts'; 8 import type { SellingView } from '../../src/lib/publishing/selling-view.ts'; 9 10 for (const context of [undefined, null, {}, { owner: 'copied' }]) 11 test(`seller index cannot acquire account storage from ${JSON.stringify(context)}`, async () => { 12 const view = await openSellingView(context as IdentityViewContext); 13 expect(view).toBeUndefined(); 14 }); 15 16 test('copied seller presentation token has no original snapshot or retirement authority', () => { 17 const copied = {} as SellingView; 18 expect(sellingViewSnapshot(copied)).toBeUndefined(); 19 expect(() => closeSellingView(copied)).not.toThrow(); 20 });