@cloudhal/comments 0.6.1 → 0.6.2
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/src/testing.d.ts +34 -0
- package/dist/src/testing.js +1665 -0
- package/package.json +13 -5
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared suites (RFC-0007 §15.1, §16), run from vitest files against SQLite and Miniflare D1 like
|
|
3
|
+
* the storage and analytics suites:
|
|
4
|
+
*
|
|
5
|
+
* - `describeCommentStoreConformance` — `SqlCommentStore`: settings and thread CAS, submissions and
|
|
6
|
+
* replay protection across store instances (C12), bulk moderation with partial results and its
|
|
7
|
+
* statement count (D1 Free write budget), labels (C9), staff replies, rendering, lists and counts,
|
|
8
|
+
* `cm1:` hashes, erasure (anonymise and delete text), bans, reports, the purge queue and
|
|
9
|
+
* retention with a mocked clock (C11). Every returned record is checked against the contract (C1).
|
|
10
|
+
* - `describeCommentPipelineSuite` — the submission pipeline on the real store, counting written
|
|
11
|
+
* statements: hostile submissions write nothing (C2), only open threads of published entries
|
|
12
|
+
* accept comments (C5), a solved challenge is accepted once (C12).
|
|
13
|
+
*/
|
|
14
|
+
import type { Comment } from "@cloudhal/core-contracts";
|
|
15
|
+
import type { SqlDriver, SqlStatement } from "@cloudhal/storage";
|
|
16
|
+
/** A key for tests only; deployments generate their own `CLOUDHAL_COMMENTS_KEY`. */
|
|
17
|
+
export declare const TEST_COMMENTS_KEY = "conformance-test-key-not-a-secret-0000000";
|
|
18
|
+
export interface CommentStoreFactory {
|
|
19
|
+
/** A fresh, migrated, empty database. */
|
|
20
|
+
create(): Promise<SqlDriver>;
|
|
21
|
+
dispose?(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
/** A driver that counts what it executes: write statements (run and batch), batches and reads. */
|
|
24
|
+
export interface CountingDriver extends SqlDriver {
|
|
25
|
+
readonly writes: SqlStatement[];
|
|
26
|
+
readonly batches: SqlStatement[][];
|
|
27
|
+
reads: number;
|
|
28
|
+
reset(): void;
|
|
29
|
+
}
|
|
30
|
+
export declare function countingDriver(inner: SqlDriver): CountingDriver;
|
|
31
|
+
/** Asserts a returned record is a valid `Comment` and carries no private column (C1). */
|
|
32
|
+
export declare function expectContractComment(c: Comment): void;
|
|
33
|
+
export declare function describeCommentStoreConformance(label: string, factory: CommentStoreFactory): void;
|
|
34
|
+
export declare function describeCommentPipelineSuite(label: string, factory: CommentStoreFactory): void;
|