@geekmidas/testkit 0.0.4 → 0.0.5

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.
Files changed (59) hide show
  1. package/dist/Factory.mjs +1 -1
  2. package/dist/{KyselyFactory-BGvSMLtd.cjs → KyselyFactory-BX7Kv2uP.cjs} +1 -1
  3. package/dist/{KyselyFactory-ionH4gvk.mjs → KyselyFactory-pOMOFQWE.mjs} +2 -2
  4. package/dist/KyselyFactory.cjs +2 -2
  5. package/dist/KyselyFactory.mjs +3 -3
  6. package/dist/{ObjectionFactory-CFrtXe7i.mjs → ObjectionFactory-ChuX8sZN.mjs} +1 -1
  7. package/dist/ObjectionFactory.mjs +2 -2
  8. package/dist/{PostgresKyselyMigrator-CbtiZgfI.mjs → PostgresKyselyMigrator-D8fm35-s.mjs} +1 -1
  9. package/dist/{PostgresKyselyMigrator-Cxf2Dp9y.cjs → PostgresKyselyMigrator-JTY2LfwD.cjs} +2 -2
  10. package/dist/PostgresKyselyMigrator.cjs +2 -2
  11. package/dist/PostgresKyselyMigrator.mjs +2 -2
  12. package/dist/{PostgresMigrator-eqyAFSf-.cjs → PostgresMigrator-Bz-tnjB6.cjs} +1 -1
  13. package/dist/PostgresMigrator.cjs +1 -1
  14. package/dist/PostgresMigrator.mjs +1 -1
  15. package/dist/{VitestKyselyTransactionIsolator-DXjWQtDN.mjs → VitestKyselyTransactionIsolator-BS3R-V0I.mjs} +1 -1
  16. package/dist/{VitestKyselyTransactionIsolator-Dh2AgJDd.cjs → VitestKyselyTransactionIsolator-DWSTKIe3.cjs} +1 -1
  17. package/dist/VitestKyselyTransactionIsolator.cjs +2 -3
  18. package/dist/VitestKyselyTransactionIsolator.mjs +2 -3
  19. package/dist/{VitestTransactionIsolator-pLwsDo_A.mjs → VitestTransactionIsolator-BjVXqFs6.mjs} +1 -1
  20. package/dist/{VitestTransactionIsolator-zK5NJ7DQ.cjs → VitestTransactionIsolator-Bx2c4OzK.cjs} +3 -2
  21. package/dist/VitestTransactionIsolator.cjs +1 -2
  22. package/dist/VitestTransactionIsolator.mjs +1 -2
  23. package/dist/__tests__/Factory.spec.cjs +42 -42
  24. package/dist/__tests__/Factory.spec.mjs +23 -24
  25. package/dist/__tests__/KyselyFactory.spec.cjs +46 -47
  26. package/dist/__tests__/KyselyFactory.spec.mjs +40 -41
  27. package/dist/__tests__/ObjectionFactory.spec.cjs +80 -81
  28. package/dist/__tests__/ObjectionFactory.spec.mjs +52 -53
  29. package/dist/__tests__/PostgresMigrator.spec.cjs +59 -60
  30. package/dist/__tests__/PostgresMigrator.spec.mjs +31 -32
  31. package/dist/__tests__/faker.spec.cjs +60 -60
  32. package/dist/__tests__/faker.spec.mjs +35 -36
  33. package/dist/__tests__/integration.spec.cjs +40 -40
  34. package/dist/__tests__/integration.spec.mjs +42 -43
  35. package/dist/{chunk-DWy1uDak.cjs → chunk-CUT6urMc.cjs} +0 -9
  36. package/dist/example.cjs +2 -2
  37. package/dist/example.mjs +3 -3
  38. package/dist/{faker-h6CkRloU.cjs → faker-caz-8zt8.cjs} +1 -1
  39. package/dist/faker.cjs +1 -1
  40. package/dist/faker.mjs +1 -1
  41. package/dist/{helpers-C_RZk04R.cjs → helpers-B9Jdk_C7.cjs} +3 -3
  42. package/dist/{helpers-C2NH7xcz.cjs → helpers-DKEBHABj.cjs} +1 -1
  43. package/dist/{helpers-BnARb5Ap.mjs → helpers-DOiGIkaU.mjs} +2 -2
  44. package/dist/helpers.cjs +3 -4
  45. package/dist/helpers.mjs +3 -4
  46. package/dist/kysely.cjs +6 -7
  47. package/dist/kysely.mjs +7 -8
  48. package/dist/objection.mjs +2 -2
  49. package/package.json +2 -1
  50. package/dist/dist-BM2KvLG1.mjs +0 -5618
  51. package/dist/dist-DE3gAxQI.cjs +0 -5736
  52. package/dist/magic-string.es-C6yzoryu.mjs +0 -1014
  53. package/dist/magic-string.es-jdtJrR0A.cjs +0 -1015
  54. package/dist/vi.bdSIJ99Y-BgRxGeO2.mjs +0 -9382
  55. package/dist/vi.bdSIJ99Y-CFuzUeY6.cjs +0 -9393
  56. /package/dist/{Factory-D52Lsc6Z.mjs → Factory-DlzMkMzb.mjs} +0 -0
  57. /package/dist/{PostgresMigrator-DqeuPy-e.mjs → PostgresMigrator-CEoRKTdq.mjs} +0 -0
  58. /package/dist/{faker-cGCFcrj2.mjs → faker-BwaXA_RF.mjs} +0 -0
  59. /package/dist/{helpers-CukcFAU9.mjs → helpers-BfuX-cjN.mjs} +0 -0
@@ -1,6 +1,5 @@
1
- import { beforeEach, describe, it } from "../dist-BM2KvLG1.mjs";
2
- import { faker } from "../faker-cGCFcrj2.mjs";
3
- import { globalExpect } from "../vi.bdSIJ99Y-BgRxGeO2.mjs";
1
+ import { faker } from "../faker-BwaXA_RF.mjs";
2
+ import { beforeEach, describe, expect, it } from "vitest";
4
3
 
5
4
  //#region src/__tests__/faker.spec.ts
6
5
  describe("faker", () => {
@@ -9,26 +8,26 @@ describe("faker", () => {
9
8
  faker.resetAllSequences();
10
9
  });
11
10
  it("should start from 1 for a new sequence", () => {
12
- globalExpect(faker.sequence()).toBe(1);
13
- globalExpect(faker.sequence("custom")).toBe(1);
11
+ expect(faker.sequence()).toBe(1);
12
+ expect(faker.sequence("custom")).toBe(1);
14
13
  });
15
14
  it("should increment on each call", () => {
16
- globalExpect(faker.sequence()).toBe(1);
17
- globalExpect(faker.sequence()).toBe(2);
18
- globalExpect(faker.sequence()).toBe(3);
15
+ expect(faker.sequence()).toBe(1);
16
+ expect(faker.sequence()).toBe(2);
17
+ expect(faker.sequence()).toBe(3);
19
18
  });
20
19
  it("should maintain separate counters for different names", () => {
21
- globalExpect(faker.sequence("users")).toBe(1);
22
- globalExpect(faker.sequence("posts")).toBe(1);
23
- globalExpect(faker.sequence("users")).toBe(2);
24
- globalExpect(faker.sequence("posts")).toBe(2);
25
- globalExpect(faker.sequence("users")).toBe(3);
26
- globalExpect(faker.sequence("posts")).toBe(3);
20
+ expect(faker.sequence("users")).toBe(1);
21
+ expect(faker.sequence("posts")).toBe(1);
22
+ expect(faker.sequence("users")).toBe(2);
23
+ expect(faker.sequence("posts")).toBe(2);
24
+ expect(faker.sequence("users")).toBe(3);
25
+ expect(faker.sequence("posts")).toBe(3);
27
26
  });
28
27
  it("should handle concurrent-like sequential calls", () => {
29
28
  const results = [];
30
29
  for (let i = 0; i < 100; i++) results.push(faker.sequence("concurrent"));
31
- globalExpect(results).toEqual(Array.from({ length: 100 }, (_, i) => i + 1));
30
+ expect(results).toEqual(Array.from({ length: 100 }, (_, i) => i + 1));
32
31
  });
33
32
  });
34
33
  describe("resetSequence", () => {
@@ -38,26 +37,26 @@ describe("faker", () => {
38
37
  it("should reset a specific sequence to 0", () => {
39
38
  faker.sequence("test");
40
39
  faker.sequence("test");
41
- globalExpect(faker.sequence("test")).toBe(3);
40
+ expect(faker.sequence("test")).toBe(3);
42
41
  faker.resetSequence("test");
43
- globalExpect(faker.sequence("test")).toBe(1);
42
+ expect(faker.sequence("test")).toBe(1);
44
43
  });
45
44
  it("should reset a specific sequence to a custom value", () => {
46
45
  faker.sequence("test");
47
46
  faker.resetSequence("test", 10);
48
- globalExpect(faker.sequence("test")).toBe(11);
47
+ expect(faker.sequence("test")).toBe(11);
49
48
  });
50
49
  it("should create a new sequence if it does not exist", () => {
51
50
  faker.resetSequence("new", 5);
52
- globalExpect(faker.sequence("new")).toBe(6);
51
+ expect(faker.sequence("new")).toBe(6);
53
52
  });
54
53
  it("should not affect other sequences", () => {
55
54
  faker.sequence("test1");
56
55
  faker.sequence("test1");
57
56
  faker.sequence("test2");
58
57
  faker.resetSequence("test1");
59
- globalExpect(faker.sequence("test1")).toBe(1);
60
- globalExpect(faker.sequence("test2")).toBe(2);
58
+ expect(faker.sequence("test1")).toBe(1);
59
+ expect(faker.sequence("test2")).toBe(2);
61
60
  });
62
61
  });
63
62
  describe("resetAllSequences", () => {
@@ -68,9 +67,9 @@ describe("faker", () => {
68
67
  faker.sequence("test2");
69
68
  faker.sequence("test2");
70
69
  faker.resetAllSequences();
71
- globalExpect(faker.sequence("test1")).toBe(1);
72
- globalExpect(faker.sequence("test2")).toBe(1);
73
- globalExpect(faker.sequence()).toBe(1);
70
+ expect(faker.sequence("test1")).toBe(1);
71
+ expect(faker.sequence("test2")).toBe(1);
72
+ expect(faker.sequence()).toBe(1);
74
73
  });
75
74
  });
76
75
  describe("identifier", () => {
@@ -80,34 +79,34 @@ describe("faker", () => {
80
79
  it("should include sequence number in identifier", () => {
81
80
  const id1 = faker.identifier();
82
81
  const id2 = faker.identifier();
83
- globalExpect(id1).not.toBe(id2);
84
- globalExpect(id1).toMatch(/1$/);
85
- globalExpect(id2).toMatch(/2$/);
82
+ expect(id1).not.toBe(id2);
83
+ expect(id1).toMatch(/1$/);
84
+ expect(id2).toMatch(/2$/);
86
85
  });
87
86
  it("should use custom suffix when provided", () => {
88
87
  const id = faker.identifier("customSuffix");
89
- globalExpect(id).toMatch(/\.customSuffix$/);
88
+ expect(id).toMatch(/\.customSuffix$/);
90
89
  });
91
90
  });
92
91
  describe("timestamps", () => {
93
92
  it("should return createdAt and updatedAt dates", () => {
94
93
  const { createdAt, updatedAt } = faker.timestamps();
95
- globalExpect(createdAt).toBeInstanceOf(Date);
96
- globalExpect(updatedAt).toBeInstanceOf(Date);
97
- globalExpect(createdAt.getTime()).toBeLessThanOrEqual(updatedAt.getTime());
98
- globalExpect(updatedAt.getTime()).toBeLessThanOrEqual((/* @__PURE__ */ new Date()).getTime());
94
+ expect(createdAt).toBeInstanceOf(Date);
95
+ expect(updatedAt).toBeInstanceOf(Date);
96
+ expect(createdAt.getTime()).toBeLessThanOrEqual(updatedAt.getTime());
97
+ expect(updatedAt.getTime()).toBeLessThanOrEqual((/* @__PURE__ */ new Date()).getTime());
99
98
  });
100
99
  it("should have milliseconds set to 0", () => {
101
100
  const { createdAt, updatedAt } = faker.timestamps();
102
- globalExpect(createdAt.getMilliseconds()).toBe(0);
103
- globalExpect(updatedAt.getMilliseconds()).toBe(0);
101
+ expect(createdAt.getMilliseconds()).toBe(0);
102
+ expect(updatedAt.getMilliseconds()).toBe(0);
104
103
  });
105
104
  });
106
105
  describe("price", () => {
107
106
  it("should return a number", () => {
108
107
  const result = faker.price();
109
- globalExpect(typeof result).toBe("number");
110
- globalExpect(result).toBeGreaterThan(0);
108
+ expect(typeof result).toBe("number");
109
+ expect(result).toBeGreaterThan(0);
111
110
  });
112
111
  });
113
112
  });
@@ -1,19 +1,19 @@
1
+ const require_chunk = require('../chunk-CUT6urMc.cjs');
1
2
  require('../Factory-DREHoms3.cjs');
2
- require('../faker-h6CkRloU.cjs');
3
- const require_KyselyFactory = require('../KyselyFactory-BGvSMLtd.cjs');
4
- const require_dist = require('../dist-DE3gAxQI.cjs');
5
- const require_vi_bdSIJ99Y = require('../vi.bdSIJ99Y-CFuzUeY6.cjs');
6
- require('../VitestTransactionIsolator-zK5NJ7DQ.cjs');
7
- require('../VitestKyselyTransactionIsolator-Dh2AgJDd.cjs');
8
- const require_helpers = require('../helpers-C_RZk04R.cjs');
9
- const require_helpers$1 = require('../helpers-C2NH7xcz.cjs');
3
+ require('../faker-caz-8zt8.cjs');
4
+ const require_KyselyFactory = require('../KyselyFactory-BX7Kv2uP.cjs');
5
+ require('../VitestTransactionIsolator-Bx2c4OzK.cjs');
6
+ require('../VitestKyselyTransactionIsolator-DWSTKIe3.cjs');
7
+ const require_helpers = require('../helpers-B9Jdk_C7.cjs');
8
+ const require_helpers$1 = require('../helpers-DKEBHABj.cjs');
9
+ const vitest = require_chunk.__toESM(require("vitest"));
10
10
 
11
11
  //#region src/__tests__/integration.spec.ts
12
12
  const db = require_helpers.createKyselyDb(require_helpers$1.TEST_DATABASE_CONFIG);
13
13
  const it = require_helpers.wrapVitestKyselyTransaction(db, require_helpers$1.createTestTables);
14
- require_dist.describe("Testkit Integration Tests", () => {
15
- require_dist.beforeAll(async () => {});
16
- require_dist.describe("Complex Factory Scenarios", () => {
14
+ (0, vitest.describe)("Testkit Integration Tests", () => {
15
+ (0, vitest.beforeAll)(async () => {});
16
+ (0, vitest.describe)("Complex Factory Scenarios", () => {
17
17
  it("should handle complex multi-table data creation", async ({ trx }) => {
18
18
  const userBuilder = require_KyselyFactory.KyselyFactory.createBuilder("users", async (attrs) => ({
19
19
  name: "John Doe",
@@ -81,21 +81,21 @@ require_dist.describe("Testkit Integration Tests", () => {
81
81
  content: `Comment ${idx + 1} on first post`,
82
82
  postId: posts[0].id
83
83
  }));
84
- require_vi_bdSIJ99Y.globalExpect(author.name).toBe("Jane Author");
85
- require_vi_bdSIJ99Y.globalExpect(author.role).toBe("admin");
86
- require_vi_bdSIJ99Y.globalExpect(posts).toHaveLength(3);
87
- require_vi_bdSIJ99Y.globalExpect(posts[0].title).toBe("Post 1");
88
- require_vi_bdSIJ99Y.globalExpect(posts[0].published).toBe(true);
89
- require_vi_bdSIJ99Y.globalExpect(posts[2].published).toBe(false);
90
- require_vi_bdSIJ99Y.globalExpect(comments).toHaveLength(5);
84
+ (0, vitest.expect)(author.name).toBe("Jane Author");
85
+ (0, vitest.expect)(author.role).toBe("admin");
86
+ (0, vitest.expect)(posts).toHaveLength(3);
87
+ (0, vitest.expect)(posts[0].title).toBe("Post 1");
88
+ (0, vitest.expect)(posts[0].published).toBe(true);
89
+ (0, vitest.expect)(posts[2].published).toBe(false);
90
+ (0, vitest.expect)(comments).toHaveLength(5);
91
91
  comments.forEach((comment, idx) => {
92
- require_vi_bdSIJ99Y.globalExpect(comment.content).toBe(`Comment ${idx + 1} on first post`);
93
- require_vi_bdSIJ99Y.globalExpect(comment.postId).toBe(posts[0].id);
92
+ (0, vitest.expect)(comment.content).toBe(`Comment ${idx + 1} on first post`);
93
+ (0, vitest.expect)(comment.postId).toBe(posts[0].id);
94
94
  });
95
95
  const authorPosts = await trx.selectFrom("posts").selectAll().where("userId", "=", author.id).execute();
96
- require_vi_bdSIJ99Y.globalExpect(authorPosts).toHaveLength(3);
96
+ (0, vitest.expect)(authorPosts).toHaveLength(3);
97
97
  const firstPostComments = await trx.selectFrom("comments").selectAll().where("postId", "=", posts[0].id).execute();
98
- require_vi_bdSIJ99Y.globalExpect(firstPostComments).toHaveLength(5);
98
+ (0, vitest.expect)(firstPostComments).toHaveLength(5);
99
99
  });
100
100
  it("should handle seeds for complex scenarios", async ({ trx }) => {
101
101
  const c = await trx.selectFrom("users").select(trx.fn.count("id").as("count")).executeTakeFirst();
@@ -179,19 +179,19 @@ require_dist.describe("Testkit Integration Tests", () => {
179
179
  };
180
180
  const factory = new require_KyselyFactory.KyselyFactory(builders, seeds, trx);
181
181
  const blogData = await factory.seed("blogWithAdminAndPosts", { postCount: 5 });
182
- require_vi_bdSIJ99Y.globalExpect(blogData.admin.name).toBe("Blog Admin");
183
- require_vi_bdSIJ99Y.globalExpect(blogData.admin.role).toBe("admin");
184
- require_vi_bdSIJ99Y.globalExpect(blogData.posts).toHaveLength(5);
185
- require_vi_bdSIJ99Y.globalExpect(blogData.summary.totalPosts).toBe(5);
182
+ (0, vitest.expect)(blogData.admin.name).toBe("Blog Admin");
183
+ (0, vitest.expect)(blogData.admin.role).toBe("admin");
184
+ (0, vitest.expect)(blogData.posts).toHaveLength(5);
185
+ (0, vitest.expect)(blogData.summary.totalPosts).toBe(5);
186
186
  const userData = await factory.seed("usersWithPosts", {
187
187
  userCount: 3,
188
188
  postsPerUser: 4
189
189
  });
190
- require_vi_bdSIJ99Y.globalExpect(userData).toHaveLength(3);
190
+ (0, vitest.expect)(userData).toHaveLength(3);
191
191
  const totalUsers = await trx.selectFrom("users").select(trx.fn.count("id").as("count")).executeTakeFirst();
192
192
  const totalPosts = await trx.selectFrom("posts").select(trx.fn.count("id").as("count")).executeTakeFirst();
193
- require_vi_bdSIJ99Y.globalExpect(Number(totalUsers?.count)).toBe(4);
194
- require_vi_bdSIJ99Y.globalExpect(Number(totalPosts?.count)).toBe(17);
193
+ (0, vitest.expect)(Number(totalUsers?.count)).toBe(4);
194
+ (0, vitest.expect)(Number(totalPosts?.count)).toBe(17);
195
195
  });
196
196
  it("should handle transaction isolation properly", async ({ trx }) => {
197
197
  const userBuilder = require_KyselyFactory.KyselyFactory.createBuilder("users", async (attrs, factory, db$1, faker) => ({
@@ -208,11 +208,11 @@ require_dist.describe("Testkit Integration Tests", () => {
208
208
  email: "transaction@test.com"
209
209
  });
210
210
  const userInTrx = await trx.selectFrom("users").selectAll().where("id", "=", user.id).executeTakeFirst();
211
- require_vi_bdSIJ99Y.globalExpect(userInTrx).toBeDefined();
212
- require_vi_bdSIJ99Y.globalExpect(userInTrx?.name).toBe("Transaction User");
211
+ (0, vitest.expect)(userInTrx).toBeDefined();
212
+ (0, vitest.expect)(userInTrx?.name).toBe("Transaction User");
213
213
  });
214
214
  });
215
- require_dist.describe("Performance and Edge Cases", () => {
215
+ (0, vitest.describe)("Performance and Edge Cases", () => {
216
216
  it("should handle creating many records efficiently", async ({ trx }) => {
217
217
  const userBuilder = require_KyselyFactory.KyselyFactory.createBuilder("users", async (attrs, factory$1, db$1, faker) => ({
218
218
  name: `User ${Math.random()}`,
@@ -227,11 +227,11 @@ require_dist.describe("Testkit Integration Tests", () => {
227
227
  const users = await factory.insertMany(100, "user");
228
228
  const endTime = Date.now();
229
229
  const duration = endTime - startTime;
230
- require_vi_bdSIJ99Y.globalExpect(users).toHaveLength(100);
231
- require_vi_bdSIJ99Y.globalExpect(duration).toBeLessThan(5e3);
230
+ (0, vitest.expect)(users).toHaveLength(100);
231
+ (0, vitest.expect)(duration).toBeLessThan(5e3);
232
232
  const emails = users.map((u) => u.email);
233
233
  const uniqueEmails = new Set(emails);
234
- require_vi_bdSIJ99Y.globalExpect(uniqueEmails.size).toBe(100);
234
+ (0, vitest.expect)(uniqueEmails.size).toBe(100);
235
235
  });
236
236
  it("should handle complex attribute generation", async ({ trx }) => {
237
237
  const userBuilder = require_KyselyFactory.KyselyFactory.createBuilder("users", async (attrs, factory$1, db$1, faker) => {
@@ -262,16 +262,16 @@ require_dist.describe("Testkit Integration Tests", () => {
262
262
  };
263
263
  const factory = new require_KyselyFactory.KyselyFactory(builders, {}, trx);
264
264
  const posts = await factory.insertMany(10, "post", (i) => ({ published: i % 2 === 0 }));
265
- require_vi_bdSIJ99Y.globalExpect(posts).toHaveLength(10);
265
+ (0, vitest.expect)(posts).toHaveLength(10);
266
266
  const users = await trx.selectFrom("users").selectAll().execute();
267
267
  users.forEach((user) => {
268
- require_vi_bdSIJ99Y.globalExpect(user.email).toBe(user.email.toLowerCase());
269
- require_vi_bdSIJ99Y.globalExpect(user.name).not.toMatch(/^\s|\s$/);
268
+ (0, vitest.expect)(user.email).toBe(user.email.toLowerCase());
269
+ (0, vitest.expect)(user.name).not.toMatch(/^\s|\s$/);
270
270
  });
271
271
  const publishedPosts = posts.filter((p) => p.published);
272
272
  const unpublishedPosts = posts.filter((p) => !p.published);
273
- require_vi_bdSIJ99Y.globalExpect(publishedPosts).toHaveLength(5);
274
- require_vi_bdSIJ99Y.globalExpect(unpublishedPosts).toHaveLength(5);
273
+ (0, vitest.expect)(publishedPosts).toHaveLength(5);
274
+ (0, vitest.expect)(unpublishedPosts).toHaveLength(5);
275
275
  });
276
276
  });
277
277
  });
@@ -1,20 +1,19 @@
1
- import { beforeAll, describe } from "../dist-BM2KvLG1.mjs";
2
- import "../Factory-D52Lsc6Z.mjs";
3
- import "../faker-cGCFcrj2.mjs";
4
- import { KyselyFactory } from "../KyselyFactory-ionH4gvk.mjs";
5
- import { globalExpect } from "../vi.bdSIJ99Y-BgRxGeO2.mjs";
6
- import "../VitestTransactionIsolator-pLwsDo_A.mjs";
7
- import "../VitestKyselyTransactionIsolator-DXjWQtDN.mjs";
8
- import { createKyselyDb, wrapVitestKyselyTransaction } from "../helpers-BnARb5Ap.mjs";
9
- import { TEST_DATABASE_CONFIG, createTestTables } from "../helpers-CukcFAU9.mjs";
1
+ import "../Factory-DlzMkMzb.mjs";
2
+ import "../faker-BwaXA_RF.mjs";
3
+ import { KyselyFactory } from "../KyselyFactory-pOMOFQWE.mjs";
4
+ import "../VitestTransactionIsolator-BjVXqFs6.mjs";
5
+ import "../VitestKyselyTransactionIsolator-BS3R-V0I.mjs";
6
+ import { createKyselyDb, wrapVitestKyselyTransaction } from "../helpers-DOiGIkaU.mjs";
7
+ import { TEST_DATABASE_CONFIG, createTestTables } from "../helpers-BfuX-cjN.mjs";
8
+ import { beforeAll, describe, expect } from "vitest";
10
9
 
11
10
  //#region src/__tests__/integration.spec.ts
12
11
  const db = createKyselyDb(TEST_DATABASE_CONFIG);
13
- const it = wrapVitestKyselyTransaction(db, createTestTables);
12
+ const it$1 = wrapVitestKyselyTransaction(db, createTestTables);
14
13
  describe("Testkit Integration Tests", () => {
15
14
  beforeAll(async () => {});
16
15
  describe("Complex Factory Scenarios", () => {
17
- it("should handle complex multi-table data creation", async ({ trx }) => {
16
+ it$1("should handle complex multi-table data creation", async ({ trx }) => {
18
17
  const userBuilder = KyselyFactory.createBuilder("users", async (attrs) => ({
19
18
  name: "John Doe",
20
19
  email: `user${Date.now()}-${Math.random()}@example.com`,
@@ -81,23 +80,23 @@ describe("Testkit Integration Tests", () => {
81
80
  content: `Comment ${idx + 1} on first post`,
82
81
  postId: posts[0].id
83
82
  }));
84
- globalExpect(author.name).toBe("Jane Author");
85
- globalExpect(author.role).toBe("admin");
86
- globalExpect(posts).toHaveLength(3);
87
- globalExpect(posts[0].title).toBe("Post 1");
88
- globalExpect(posts[0].published).toBe(true);
89
- globalExpect(posts[2].published).toBe(false);
90
- globalExpect(comments).toHaveLength(5);
83
+ expect(author.name).toBe("Jane Author");
84
+ expect(author.role).toBe("admin");
85
+ expect(posts).toHaveLength(3);
86
+ expect(posts[0].title).toBe("Post 1");
87
+ expect(posts[0].published).toBe(true);
88
+ expect(posts[2].published).toBe(false);
89
+ expect(comments).toHaveLength(5);
91
90
  comments.forEach((comment, idx) => {
92
- globalExpect(comment.content).toBe(`Comment ${idx + 1} on first post`);
93
- globalExpect(comment.postId).toBe(posts[0].id);
91
+ expect(comment.content).toBe(`Comment ${idx + 1} on first post`);
92
+ expect(comment.postId).toBe(posts[0].id);
94
93
  });
95
94
  const authorPosts = await trx.selectFrom("posts").selectAll().where("userId", "=", author.id).execute();
96
- globalExpect(authorPosts).toHaveLength(3);
95
+ expect(authorPosts).toHaveLength(3);
97
96
  const firstPostComments = await trx.selectFrom("comments").selectAll().where("postId", "=", posts[0].id).execute();
98
- globalExpect(firstPostComments).toHaveLength(5);
97
+ expect(firstPostComments).toHaveLength(5);
99
98
  });
100
- it("should handle seeds for complex scenarios", async ({ trx }) => {
99
+ it$1("should handle seeds for complex scenarios", async ({ trx }) => {
101
100
  const c = await trx.selectFrom("users").select(trx.fn.count("id").as("count")).executeTakeFirst();
102
101
  const userBuilder = KyselyFactory.createBuilder("users", async (attrs) => ({
103
102
  name: "Default User",
@@ -179,21 +178,21 @@ describe("Testkit Integration Tests", () => {
179
178
  };
180
179
  const factory = new KyselyFactory(builders, seeds, trx);
181
180
  const blogData = await factory.seed("blogWithAdminAndPosts", { postCount: 5 });
182
- globalExpect(blogData.admin.name).toBe("Blog Admin");
183
- globalExpect(blogData.admin.role).toBe("admin");
184
- globalExpect(blogData.posts).toHaveLength(5);
185
- globalExpect(blogData.summary.totalPosts).toBe(5);
181
+ expect(blogData.admin.name).toBe("Blog Admin");
182
+ expect(blogData.admin.role).toBe("admin");
183
+ expect(blogData.posts).toHaveLength(5);
184
+ expect(blogData.summary.totalPosts).toBe(5);
186
185
  const userData = await factory.seed("usersWithPosts", {
187
186
  userCount: 3,
188
187
  postsPerUser: 4
189
188
  });
190
- globalExpect(userData).toHaveLength(3);
189
+ expect(userData).toHaveLength(3);
191
190
  const totalUsers = await trx.selectFrom("users").select(trx.fn.count("id").as("count")).executeTakeFirst();
192
191
  const totalPosts = await trx.selectFrom("posts").select(trx.fn.count("id").as("count")).executeTakeFirst();
193
- globalExpect(Number(totalUsers?.count)).toBe(4);
194
- globalExpect(Number(totalPosts?.count)).toBe(17);
192
+ expect(Number(totalUsers?.count)).toBe(4);
193
+ expect(Number(totalPosts?.count)).toBe(17);
195
194
  });
196
- it("should handle transaction isolation properly", async ({ trx }) => {
195
+ it$1("should handle transaction isolation properly", async ({ trx }) => {
197
196
  const userBuilder = KyselyFactory.createBuilder("users", async (attrs, factory, db$1, faker) => ({
198
197
  name: "Test User",
199
198
  email: faker.internet.email(),
@@ -208,12 +207,12 @@ describe("Testkit Integration Tests", () => {
208
207
  email: "transaction@test.com"
209
208
  });
210
209
  const userInTrx = await trx.selectFrom("users").selectAll().where("id", "=", user.id).executeTakeFirst();
211
- globalExpect(userInTrx).toBeDefined();
212
- globalExpect(userInTrx?.name).toBe("Transaction User");
210
+ expect(userInTrx).toBeDefined();
211
+ expect(userInTrx?.name).toBe("Transaction User");
213
212
  });
214
213
  });
215
214
  describe("Performance and Edge Cases", () => {
216
- it("should handle creating many records efficiently", async ({ trx }) => {
215
+ it$1("should handle creating many records efficiently", async ({ trx }) => {
217
216
  const userBuilder = KyselyFactory.createBuilder("users", async (attrs, factory$1, db$1, faker) => ({
218
217
  name: `User ${Math.random()}`,
219
218
  email: faker.internet.email().toLowerCase(),
@@ -227,13 +226,13 @@ describe("Testkit Integration Tests", () => {
227
226
  const users = await factory.insertMany(100, "user");
228
227
  const endTime = Date.now();
229
228
  const duration = endTime - startTime;
230
- globalExpect(users).toHaveLength(100);
231
- globalExpect(duration).toBeLessThan(5e3);
229
+ expect(users).toHaveLength(100);
230
+ expect(duration).toBeLessThan(5e3);
232
231
  const emails = users.map((u) => u.email);
233
232
  const uniqueEmails = new Set(emails);
234
- globalExpect(uniqueEmails.size).toBe(100);
233
+ expect(uniqueEmails.size).toBe(100);
235
234
  });
236
- it("should handle complex attribute generation", async ({ trx }) => {
235
+ it$1("should handle complex attribute generation", async ({ trx }) => {
237
236
  const userBuilder = KyselyFactory.createBuilder("users", async (attrs, factory$1, db$1, faker) => {
238
237
  return {
239
238
  name: `Generated User ${attrs.id}`,
@@ -262,16 +261,16 @@ describe("Testkit Integration Tests", () => {
262
261
  };
263
262
  const factory = new KyselyFactory(builders, {}, trx);
264
263
  const posts = await factory.insertMany(10, "post", (i) => ({ published: i % 2 === 0 }));
265
- globalExpect(posts).toHaveLength(10);
264
+ expect(posts).toHaveLength(10);
266
265
  const users = await trx.selectFrom("users").selectAll().execute();
267
266
  users.forEach((user) => {
268
- globalExpect(user.email).toBe(user.email.toLowerCase());
269
- globalExpect(user.name).not.toMatch(/^\s|\s$/);
267
+ expect(user.email).toBe(user.email.toLowerCase());
268
+ expect(user.name).not.toMatch(/^\s|\s$/);
270
269
  });
271
270
  const publishedPosts = posts.filter((p) => p.published);
272
271
  const unpublishedPosts = posts.filter((p) => !p.published);
273
- globalExpect(publishedPosts).toHaveLength(5);
274
- globalExpect(unpublishedPosts).toHaveLength(5);
272
+ expect(publishedPosts).toHaveLength(5);
273
+ expect(unpublishedPosts).toHaveLength(5);
275
274
  });
276
275
  });
277
276
  });
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
8
  var __copyProps = (to, from, except, desc) => {
12
9
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13
10
  key = keys[i];
@@ -25,12 +22,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
22
 
26
23
  //#endregion
27
24
 
28
- Object.defineProperty(exports, '__commonJS', {
29
- enumerable: true,
30
- get: function () {
31
- return __commonJS;
32
- }
33
- });
34
25
  Object.defineProperty(exports, '__toESM', {
35
26
  enumerable: true,
36
27
  get: function () {
package/dist/example.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  require('./Factory-DREHoms3.cjs');
2
- require('./faker-h6CkRloU.cjs');
3
- const require_KyselyFactory = require('./KyselyFactory-BGvSMLtd.cjs');
2
+ require('./faker-caz-8zt8.cjs');
3
+ const require_KyselyFactory = require('./KyselyFactory-BX7Kv2uP.cjs');
4
4
 
5
5
  //#region src/example.ts
6
6
  const userBuilder = require_KyselyFactory.KyselyFactory.createBuilder({
package/dist/example.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import "./Factory-D52Lsc6Z.mjs";
2
- import "./faker-cGCFcrj2.mjs";
3
- import { KyselyFactory } from "./KyselyFactory-ionH4gvk.mjs";
1
+ import "./Factory-DlzMkMzb.mjs";
2
+ import "./faker-BwaXA_RF.mjs";
3
+ import { KyselyFactory } from "./KyselyFactory-pOMOFQWE.mjs";
4
4
 
5
5
  //#region src/example.ts
6
6
  const userBuilder = KyselyFactory.createBuilder({
@@ -1,4 +1,4 @@
1
- const require_chunk = require('./chunk-DWy1uDak.cjs');
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
2
  const __faker_js_faker = require_chunk.__toESM(require("@faker-js/faker"));
3
3
 
4
4
  //#region src/faker.ts
package/dist/faker.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_faker = require('./faker-h6CkRloU.cjs');
1
+ const require_faker = require('./faker-caz-8zt8.cjs');
2
2
 
3
3
  exports.faker = require_faker.faker;
4
4
  exports.identifier = require_faker.identifier;
package/dist/faker.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { faker, identifier, resetAllSequences, resetSequence, sequence, timestamps } from "./faker-cGCFcrj2.mjs";
1
+ import { faker, identifier, resetAllSequences, resetSequence, sequence, timestamps } from "./faker-BwaXA_RF.mjs";
2
2
 
3
3
  export { faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
@@ -1,6 +1,6 @@
1
- const require_chunk = require('./chunk-DWy1uDak.cjs');
2
- const require_VitestTransactionIsolator = require('./VitestTransactionIsolator-zK5NJ7DQ.cjs');
3
- const require_VitestKyselyTransactionIsolator = require('./VitestKyselyTransactionIsolator-Dh2AgJDd.cjs');
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
+ const require_VitestTransactionIsolator = require('./VitestTransactionIsolator-Bx2c4OzK.cjs');
3
+ const require_VitestKyselyTransactionIsolator = require('./VitestKyselyTransactionIsolator-DWSTKIe3.cjs');
4
4
  const kysely = require_chunk.__toESM(require("kysely"));
5
5
  const pg = require_chunk.__toESM(require("pg"));
6
6
 
@@ -1,4 +1,4 @@
1
- const require_chunk = require('./chunk-DWy1uDak.cjs');
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
2
  const kysely = require_chunk.__toESM(require("kysely"));
3
3
  const pg = require_chunk.__toESM(require("pg"));
4
4
  const knex = require_chunk.__toESM(require("knex"));
@@ -1,5 +1,5 @@
1
- import { IsolationLevel } from "./VitestTransactionIsolator-pLwsDo_A.mjs";
2
- import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator-DXjWQtDN.mjs";
1
+ import { IsolationLevel } from "./VitestTransactionIsolator-BjVXqFs6.mjs";
2
+ import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator-BS3R-V0I.mjs";
3
3
  import { CamelCasePlugin, Kysely, PostgresDialect } from "kysely";
4
4
  import pg from "pg";
5
5
 
package/dist/helpers.cjs CHANGED
@@ -1,7 +1,6 @@
1
- require('./dist-DE3gAxQI.cjs');
2
- require('./VitestTransactionIsolator-zK5NJ7DQ.cjs');
3
- require('./VitestKyselyTransactionIsolator-Dh2AgJDd.cjs');
4
- const require_helpers = require('./helpers-C_RZk04R.cjs');
1
+ require('./VitestTransactionIsolator-Bx2c4OzK.cjs');
2
+ require('./VitestKyselyTransactionIsolator-DWSTKIe3.cjs');
3
+ const require_helpers = require('./helpers-B9Jdk_C7.cjs');
5
4
 
6
5
  exports.createKyselyDb = require_helpers.createKyselyDb;
7
6
  exports.wrapVitestKyselyTransaction = require_helpers.wrapVitestKyselyTransaction;
package/dist/helpers.mjs CHANGED
@@ -1,6 +1,5 @@
1
- import "./dist-BM2KvLG1.mjs";
2
- import "./VitestTransactionIsolator-pLwsDo_A.mjs";
3
- import "./VitestKyselyTransactionIsolator-DXjWQtDN.mjs";
4
- import { createKyselyDb, wrapVitestKyselyTransaction } from "./helpers-BnARb5Ap.mjs";
1
+ import "./VitestTransactionIsolator-BjVXqFs6.mjs";
2
+ import "./VitestKyselyTransactionIsolator-BS3R-V0I.mjs";
3
+ import { createKyselyDb, wrapVitestKyselyTransaction } from "./helpers-DOiGIkaU.mjs";
5
4
 
6
5
  export { createKyselyDb, wrapVitestKyselyTransaction };
package/dist/kysely.cjs CHANGED
@@ -1,11 +1,10 @@
1
1
  require('./Factory-DREHoms3.cjs');
2
- require('./faker-h6CkRloU.cjs');
3
- const require_KyselyFactory = require('./KyselyFactory-BGvSMLtd.cjs');
4
- require('./PostgresMigrator-eqyAFSf-.cjs');
5
- const require_PostgresKyselyMigrator = require('./PostgresKyselyMigrator-Cxf2Dp9y.cjs');
6
- require('./dist-DE3gAxQI.cjs');
7
- const require_VitestTransactionIsolator = require('./VitestTransactionIsolator-zK5NJ7DQ.cjs');
8
- const require_VitestKyselyTransactionIsolator = require('./VitestKyselyTransactionIsolator-Dh2AgJDd.cjs');
2
+ require('./faker-caz-8zt8.cjs');
3
+ const require_KyselyFactory = require('./KyselyFactory-BX7Kv2uP.cjs');
4
+ require('./PostgresMigrator-Bz-tnjB6.cjs');
5
+ const require_PostgresKyselyMigrator = require('./PostgresKyselyMigrator-JTY2LfwD.cjs');
6
+ const require_VitestTransactionIsolator = require('./VitestTransactionIsolator-Bx2c4OzK.cjs');
7
+ const require_VitestKyselyTransactionIsolator = require('./VitestKyselyTransactionIsolator-DWSTKIe3.cjs');
9
8
 
10
9
  //#region src/kysely.ts
11
10
  function wrapVitestKyselyTransaction(db, setup, level = require_VitestTransactionIsolator.IsolationLevel.REPEATABLE_READ) {
package/dist/kysely.mjs CHANGED
@@ -1,11 +1,10 @@
1
- import "./dist-BM2KvLG1.mjs";
2
- import "./Factory-D52Lsc6Z.mjs";
3
- import "./faker-cGCFcrj2.mjs";
4
- import { KyselyFactory } from "./KyselyFactory-ionH4gvk.mjs";
5
- import "./PostgresMigrator-DqeuPy-e.mjs";
6
- import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator-CbtiZgfI.mjs";
7
- import { IsolationLevel } from "./VitestTransactionIsolator-pLwsDo_A.mjs";
8
- import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator-DXjWQtDN.mjs";
1
+ import "./Factory-DlzMkMzb.mjs";
2
+ import "./faker-BwaXA_RF.mjs";
3
+ import { KyselyFactory } from "./KyselyFactory-pOMOFQWE.mjs";
4
+ import "./PostgresMigrator-CEoRKTdq.mjs";
5
+ import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator-D8fm35-s.mjs";
6
+ import { IsolationLevel } from "./VitestTransactionIsolator-BjVXqFs6.mjs";
7
+ import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator-BS3R-V0I.mjs";
9
8
 
10
9
  //#region src/kysely.ts
11
10
  function wrapVitestKyselyTransaction(db, setup, level = IsolationLevel.REPEATABLE_READ) {
@@ -1,4 +1,4 @@
1
- import "./Factory-D52Lsc6Z.mjs";
2
- import { ObjectionFactory } from "./ObjectionFactory-CFrtXe7i.mjs";
1
+ import "./Factory-DlzMkMzb.mjs";
2
+ import { ObjectionFactory } from "./ObjectionFactory-ChuX8sZN.mjs";
3
3
 
4
4
  export { ObjectionFactory };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekmidas/testkit",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -36,6 +36,7 @@
36
36
  "knex": "~3.1.0",
37
37
  "objection": "~3.1.5",
38
38
  "db-errors": "~0.2.3",
39
+ "vitest": "~3.2.4",
39
40
  "@geekmidas/envkit": "0.0.3"
40
41
  }
41
42
  }