drizzle-orm-test 0.2.8 → 0.2.9
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/README.md +14 -0
- package/esm/index.js +1 -1
- package/esm/utils.js +1 -0
- package/index.d.ts +1 -1
- package/index.js +2 -1
- package/package.json +3 -3
- package/utils.d.ts +1 -0
- package/utils.js +17 -0
package/README.md
CHANGED
|
@@ -388,6 +388,20 @@ import { getConnections, PgTestClient } from 'drizzle-orm-test';
|
|
|
388
388
|
// Now you can also use Drizzle ORM with full RLS support
|
|
389
389
|
```
|
|
390
390
|
|
|
391
|
+
## Snapshot Utilities
|
|
392
|
+
|
|
393
|
+
The `drizzle-orm-test/utils` module provides utilities for sanitizing query results for snapshot testing. These helpers replace dynamic values (IDs, UUIDs, dates, hashes) with stable placeholders, making snapshots deterministic.
|
|
394
|
+
|
|
395
|
+
```ts
|
|
396
|
+
import { snapshot } from 'drizzle-orm-test/utils';
|
|
397
|
+
|
|
398
|
+
const drizzleDb = drizzle(db.client);
|
|
399
|
+
const result = await drizzleDb.select().from(users);
|
|
400
|
+
expect(snapshot(result)).toMatchSnapshot();
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
See [`pgsql-test` Snapshot Utilities](https://www.npmjs.com/package/pgsql-test#snapshot-utilities) for the full API reference.
|
|
404
|
+
|
|
391
405
|
---
|
|
392
406
|
|
|
393
407
|
## Education and Tutorials
|
package/esm/index.js
CHANGED
|
@@ -69,6 +69,6 @@ export async function getConnections(cn, seedAdapters) {
|
|
|
69
69
|
// pg is for superuser/seeding operations and should bypass RLS
|
|
70
70
|
return connections;
|
|
71
71
|
}
|
|
72
|
-
export { PgTestClient } from 'pgsql-test';
|
|
72
|
+
export { PgTestClient, snapshot } from 'pgsql-test';
|
|
73
73
|
// Re-export the proxy function for advanced use cases
|
|
74
74
|
export { proxyClientQuery } from './proxy-client';
|
package/esm/utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'pgsql-test/utils';
|
package/index.d.ts
CHANGED
|
@@ -61,5 +61,5 @@ import { GetConnectionOpts, SeedAdapter } from 'pgsql-test';
|
|
|
61
61
|
*/
|
|
62
62
|
export declare function getConnections(cn?: GetConnectionOpts, seedAdapters?: SeedAdapter[]): Promise<import("pgsql-test").GetConnectionResult>;
|
|
63
63
|
export type { GetConnectionOpts, SeedAdapter } from 'pgsql-test';
|
|
64
|
-
export { PgTestClient } from 'pgsql-test';
|
|
64
|
+
export { PgTestClient, snapshot } from 'pgsql-test';
|
|
65
65
|
export { proxyClientQuery } from './proxy-client';
|
package/index.js
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.proxyClientQuery = exports.PgTestClient = void 0;
|
|
53
|
+
exports.proxyClientQuery = exports.snapshot = exports.PgTestClient = void 0;
|
|
54
54
|
exports.getConnections = getConnections;
|
|
55
55
|
const pgsql_test_1 = require("pgsql-test");
|
|
56
56
|
const proxy_client_1 = require("./proxy-client");
|
|
@@ -75,6 +75,7 @@ async function getConnections(cn, seedAdapters) {
|
|
|
75
75
|
}
|
|
76
76
|
var pgsql_test_2 = require("pgsql-test");
|
|
77
77
|
Object.defineProperty(exports, "PgTestClient", { enumerable: true, get: function () { return pgsql_test_2.PgTestClient; } });
|
|
78
|
+
Object.defineProperty(exports, "snapshot", { enumerable: true, get: function () { return pgsql_test_2.snapshot; } });
|
|
78
79
|
// Re-export the proxy function for advanced use cases
|
|
79
80
|
var proxy_client_2 = require("./proxy-client");
|
|
80
81
|
Object.defineProperty(exports, "proxyClientQuery", { enumerable: true, get: function () { return proxy_client_2.proxyClientQuery; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drizzle-orm-test",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
5
5
|
"description": "Drop-in replacement for pgsql-test that enables Drizzle ORM to work seamlessly with context management and RLS testing",
|
|
6
6
|
"main": "index.js",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"makage": "^0.1.6"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"pgsql-test": "^2.14.
|
|
54
|
+
"pgsql-test": "^2.14.11"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"drizzle-orm": ">=0.30.0",
|
|
58
58
|
"pg": "^8.16.0"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "ff477433074d91c28be6017e858b601fa99aa568"
|
|
61
61
|
}
|
package/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'pgsql-test/utils';
|
package/utils.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("pgsql-test/utils"), exports);
|