@saasicat/persistence-testing 1.0.0-rc.13 → 1.0.0-rc.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -3,8 +3,9 @@ import { PersistenceCapabilities, TransactionRunner, SubscriptionRepository, Pla
3
3
  /**
4
4
  * Port instances under test. Required members define the minimum an adapter
5
5
  * must ship to call itself a SaaSiCat persistence adapter; optional members
6
- * activate additional scenario groups (absent the group reports as
7
- * skipped, never silently).
6
+ * activate additional scenario groups. An absent member fails its scenarios
7
+ * unless the contract options declare it in `gaps`, in which case they report
8
+ * as skipped.
8
9
  */
9
10
  interface ContractAdapterInstances {
10
11
  capabilities: PersistenceCapabilities;
@@ -125,11 +126,25 @@ interface PersistenceContractHarness {
125
126
  /** Teardown after the last scenario (close pools etc.). */
126
127
  close?(): Promise<void>;
127
128
  }
129
+ /**
130
+ * A part of the contract an adapter may deliberately not provide.
131
+ *
132
+ * Each names the members its scenarios need; `contract.ts` holds the list with
133
+ * what each one checks.
134
+ */
135
+ type ContractGap = 'atomicPlanBinding' | 'atomicOnboarding' | 'promoCodes' | 'promoCodeRedemptions' | 'promoSubscriptionLookup' | 'planRepository' | 'planLifecycle' | 'planRetirement' | 'planVersionReads' | 'planVersionRetirement' | 'bundleRepository' | 'bundleValidity' | 'bundleDraftDiscard' | 'bundleDraftPublish' | 'bundleRetirement' | 'bundleBookings' | 'halfCancelledBookingSeed' | 'countByPlanVersionId' | 'audit' | 'mfa' | 'subscriptionContracts' | 'appliedSettings';
128
136
  interface PersistenceAdapterContractOptions {
129
137
  /** Display name in the test output, e.g. `'adapter-prisma @ postgres16'`. */
130
138
  name: string;
131
139
  /** Builds the harness once for the whole suite. */
132
140
  create(): Promise<PersistenceContractHarness>;
141
+ /**
142
+ * The parts this adapter deliberately does not provide. Their scenarios
143
+ * report as skipped; a part missing without being named here fails its
144
+ * scenarios, and a part named here that the harness does provide fails
145
+ * the suite.
146
+ */
147
+ gaps?: readonly ContractGap[];
133
148
  }
134
149
 
135
150
  /**
@@ -144,4 +159,4 @@ interface PersistenceAdapterContractOptions {
144
159
  */
145
160
  declare function persistenceAdapterContract(options: PersistenceAdapterContractOptions): void;
146
161
 
147
- export { type ContractAdapterInstances, type ContractSeed, type PersistenceAdapterContractOptions, type PersistenceContractHarness, persistenceAdapterContract };
162
+ export { type ContractAdapterInstances, type ContractGap, type ContractSeed, type PersistenceAdapterContractOptions, type PersistenceContractHarness, persistenceAdapterContract };
package/dist/index.d.ts CHANGED
@@ -3,8 +3,9 @@ import { PersistenceCapabilities, TransactionRunner, SubscriptionRepository, Pla
3
3
  /**
4
4
  * Port instances under test. Required members define the minimum an adapter
5
5
  * must ship to call itself a SaaSiCat persistence adapter; optional members
6
- * activate additional scenario groups (absent the group reports as
7
- * skipped, never silently).
6
+ * activate additional scenario groups. An absent member fails its scenarios
7
+ * unless the contract options declare it in `gaps`, in which case they report
8
+ * as skipped.
8
9
  */
9
10
  interface ContractAdapterInstances {
10
11
  capabilities: PersistenceCapabilities;
@@ -125,11 +126,25 @@ interface PersistenceContractHarness {
125
126
  /** Teardown after the last scenario (close pools etc.). */
126
127
  close?(): Promise<void>;
127
128
  }
129
+ /**
130
+ * A part of the contract an adapter may deliberately not provide.
131
+ *
132
+ * Each names the members its scenarios need; `contract.ts` holds the list with
133
+ * what each one checks.
134
+ */
135
+ type ContractGap = 'atomicPlanBinding' | 'atomicOnboarding' | 'promoCodes' | 'promoCodeRedemptions' | 'promoSubscriptionLookup' | 'planRepository' | 'planLifecycle' | 'planRetirement' | 'planVersionReads' | 'planVersionRetirement' | 'bundleRepository' | 'bundleValidity' | 'bundleDraftDiscard' | 'bundleDraftPublish' | 'bundleRetirement' | 'bundleBookings' | 'halfCancelledBookingSeed' | 'countByPlanVersionId' | 'audit' | 'mfa' | 'subscriptionContracts' | 'appliedSettings';
128
136
  interface PersistenceAdapterContractOptions {
129
137
  /** Display name in the test output, e.g. `'adapter-prisma @ postgres16'`. */
130
138
  name: string;
131
139
  /** Builds the harness once for the whole suite. */
132
140
  create(): Promise<PersistenceContractHarness>;
141
+ /**
142
+ * The parts this adapter deliberately does not provide. Their scenarios
143
+ * report as skipped; a part missing without being named here fails its
144
+ * scenarios, and a part named here that the harness does provide fails
145
+ * the suite.
146
+ */
147
+ gaps?: readonly ContractGap[];
133
148
  }
134
149
 
135
150
  /**
@@ -144,4 +159,4 @@ interface PersistenceAdapterContractOptions {
144
159
  */
145
160
  declare function persistenceAdapterContract(options: PersistenceAdapterContractOptions): void;
146
161
 
147
- export { type ContractAdapterInstances, type ContractSeed, type PersistenceAdapterContractOptions, type PersistenceContractHarness, persistenceAdapterContract };
162
+ export { type ContractAdapterInstances, type ContractGap, type ContractSeed, type PersistenceAdapterContractOptions, type PersistenceContractHarness, persistenceAdapterContract };