app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

enquiry-readiness.test.ts (1370B)


      1 import { describe, expect, it } from 'vitest';
      2 import {
      3   acknowledgeProductViewUncertainty,
      4   productViewListingOwnership,
      5   type ProductView,
      6   type ProductStatusAcknowledgement
      7 } from '../../src/lib/catalog/product-view.ts';
      8 import { enquiryReadinessSnapshot } from '../../src/lib/messaging/enquiry-readiness.ts';
      9 import type { IdentitySession } from '../../src/lib/runtime/identity-session.ts';
     10 import type { InboxResolver } from '../../src/lib/messaging/resolve-inbox.ts';
     11 
     12 describe('enquiry availability uses original evidence owners', () => {
     13   it('copied view and a review string cannot acknowledge last-known status', () => {
     14     expect(
     15       acknowledgeProductViewUncertainty(
     16         {} as ProductView,
     17         'reviewed_last_known_listing'
     18       )
     19     ).toBeUndefined();
     20   });
     21   it('a copied acknowledgement cannot manufacture a listing witness', () => {
     22     expect(
     23       productViewListingOwnership(
     24         {} as ProductView,
     25         {} as ProductStatusAcknowledgement
     26       )
     27     ).toBeUndefined();
     28   });
     29   it('displayed identity, food and inbox copies cannot create readiness', () => {
     30     expect(
     31       enquiryReadinessSnapshot(
     32         {} as ProductView,
     33         {} as IdentitySession,
     34         {} as ProductStatusAcknowledgement,
     35         {} as InboxResolver
     36       )
     37     ).toMatchObject({ action: 'unavailable', sellerInbox: 'unchecked' });
     38   });
     39 });