@simplysm/orm-common 13.0.75 → 13.0.76

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 (36) hide show
  1. package/package.json +2 -2
  2. package/tests/db-context/create-db-context.spec.ts +0 -31
  3. package/tests/db-context/define-db-context.spec.ts +0 -51
  4. package/tests/ddl/basic.spec.ts +0 -157
  5. package/tests/ddl/column-builder.spec.ts +0 -112
  6. package/tests/ddl/index-builder.spec.ts +0 -54
  7. package/tests/ddl/procedure-builder.spec.ts +0 -106
  8. package/tests/ddl/relation-builder.spec.ts +0 -201
  9. package/tests/ddl/table-builder.spec.ts +0 -34
  10. package/tests/ddl/view-builder.spec.ts +0 -60
  11. package/tests/dml/delete.spec.ts +0 -33
  12. package/tests/dml/insert.spec.ts +0 -78
  13. package/tests/dml/update.spec.ts +0 -96
  14. package/tests/dml/upsert.spec.ts +0 -52
  15. package/tests/errors/queryable-errors.spec.ts +0 -51
  16. package/tests/escape.spec.ts +0 -41
  17. package/tests/examples/pivot.spec.ts +0 -333
  18. package/tests/examples/sampling.spec.ts +0 -63
  19. package/tests/examples/unpivot.spec.ts +0 -65
  20. package/tests/exec/search-parser.spec.ts +0 -16
  21. package/tests/expr/comparison.spec.ts +0 -66
  22. package/tests/expr/conditional.spec.ts +0 -27
  23. package/tests/expr/date.spec.ts +0 -67
  24. package/tests/expr/math.spec.ts +0 -47
  25. package/tests/expr/string.spec.ts +0 -56
  26. package/tests/expr/utility.spec.ts +0 -27
  27. package/tests/select/basic.spec.ts +0 -69
  28. package/tests/select/filter.spec.ts +0 -114
  29. package/tests/select/group.spec.ts +0 -85
  30. package/tests/select/join.spec.ts +0 -113
  31. package/tests/select/order.spec.ts +0 -49
  32. package/tests/select/subquery.spec.ts +0 -96
  33. package/tests/select/window.spec.ts +0 -185
  34. package/tests/types/nullable-queryable-record.spec.ts +0 -48
  35. package/tests/utils/result-parser-perf.spec.ts +0 -67
  36. package/tests/utils/result-parser.spec.ts +0 -34
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/orm-common",
3
- "version": "13.0.75",
3
+ "version": "13.0.76",
4
4
  "description": "Simplysm Package - ORM Module (common)",
5
5
  "author": "simplysm",
6
6
  "license": "Apache-2.0",
@@ -19,6 +19,6 @@
19
19
  ],
20
20
  "sideEffects": false,
21
21
  "dependencies": {
22
- "@simplysm/core-common": "13.0.75"
22
+ "@simplysm/core-common": "13.0.76"
23
23
  }
24
24
  }
@@ -50,21 +50,6 @@ describe("createDbContext", () => {
50
50
  expect(postDef.as).toBe("T2");
51
51
  });
52
52
 
53
- it("DDL methods exist on instance", () => {
54
- const db = createDbContext(TestDb, new MockExecutor(), {
55
- database: "TestDb",
56
- });
57
-
58
- // QueryDef generators
59
- expect(typeof db.getCreateTableQueryDef).toBe("function");
60
- expect(typeof db.getAddColumnQueryDef).toBe("function");
61
- expect(typeof db.getClearSchemaQueryDef).toBe("function");
62
-
63
- // Execution methods
64
- expect(typeof db.createTable).toBe("function");
65
- expect(typeof db.addColumn).toBe("function");
66
- });
67
-
68
53
  it("DDL QueryDef generators produce correct output", () => {
69
54
  const db = createDbContext(TestDb, new MockExecutor(), {
70
55
  database: "TestDb",
@@ -192,22 +177,6 @@ describe("createDbContext", () => {
192
177
  });
193
178
  });
194
179
 
195
- it("_migration accessor exists", () => {
196
- const db = createDbContext(TestDb, new MockExecutor(), {
197
- database: "TestDb",
198
- });
199
-
200
- expect(typeof db._migration).toBe("function");
201
- });
202
-
203
- it("initialize method exists", () => {
204
- const db = createDbContext(TestDb, new MockExecutor(), {
205
- database: "TestDb",
206
- });
207
-
208
- expect(typeof db.initialize).toBe("function");
209
- });
210
-
211
180
  it("getQueryDefObjectName resolves table with defaults", () => {
212
181
  const db = createDbContext(TestDb, new MockExecutor(), {
213
182
  database: "TestDb",
@@ -1,40 +1,7 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import type { DbContextBase, DbContextDef } from "../../src/types/db-context-def";
3
2
  import { defineDbContext } from "../../src/define-db-context";
4
3
  import { User } from "../setup/models/User";
5
4
  import { Post } from "../setup/models/Post";
6
- import { ActiveUsers } from "../setup/views/ActiveUsers";
7
-
8
- describe("DbContext Types", () => {
9
- it("DbContextBase interface has required members", () => {
10
- // Type-level test: verify the interface exists with correct shape
11
- const base: DbContextBase = {
12
- status: "ready",
13
- database: "test",
14
- schema: undefined,
15
- getNextAlias: () => "T1",
16
- resetAliasCounter: () => {},
17
- executeDefs: () => Promise.resolve([[]]),
18
- getQueryDefObjectName: () => ({ database: "test", name: "test" }),
19
- switchFk: () => Promise.resolve(),
20
- };
21
- expect(base.status).toBe("ready");
22
- expect(base.getNextAlias()).toBe("T1");
23
- });
24
-
25
- it("DbContextDef has meta property", () => {
26
- const def: DbContextDef<{}, {}> = {
27
- meta: {
28
- tables: {},
29
- views: {},
30
- procedures: {},
31
- migrations: [],
32
- },
33
- };
34
- expect(def.meta.tables).toEqual({});
35
- expect(def.meta.migrations).toEqual([]);
36
- });
37
- });
38
5
 
39
6
  describe("defineDbContext", () => {
40
7
  it("creates a DbContextDef with tables", () => {
@@ -47,22 +14,4 @@ describe("defineDbContext", () => {
47
14
  expect(MyDb.meta.migrations).toEqual([]);
48
15
  });
49
16
 
50
- it("creates a DbContextDef with views", () => {
51
- const MyDb = defineDbContext({
52
- tables: { user: User },
53
- views: { activeUsers: ActiveUsers },
54
- });
55
-
56
- expect(MyDb.meta.views.activeUsers).toBe(ActiveUsers);
57
- });
58
-
59
- it("creates a DbContextDef with migrations", () => {
60
- const migrations = [{ name: "test", up: async () => {} }];
61
- const MyDb = defineDbContext({
62
- tables: { user: User },
63
- migrations,
64
- });
65
-
66
- expect(MyDb.meta.migrations).toBe(migrations);
67
- });
68
17
  });
@@ -122,65 +122,6 @@ describe("DDL - Table", () => {
122
122
  });
123
123
  });
124
124
 
125
- describe("getTruncateQueryDef", () => {
126
- const db = createTestDb();
127
- const def = db.getTruncateQueryDef({ database: "TestDb", schema: "TestSchema", name: "User" });
128
-
129
- it("should validate QueryDef", () => {
130
- expect(def).toEqual({
131
- type: "truncate",
132
- table: { database: "TestDb", schema: "TestSchema", name: "User" },
133
- });
134
- });
135
-
136
- it.each(dialects)("[%s] should validate SQL", (dialect) => {
137
- const builder = createQueryBuilder(dialect);
138
- expect(builder.build(def)).toMatchSql(expected.truncate[dialect]);
139
- });
140
- });
141
-
142
- describe("getSwitchFkQueryDef - on", () => {
143
- const db = createTestDb();
144
- const def = db.getSwitchFkQueryDef(
145
- { database: "TestDb", schema: "TestSchema", name: "User" },
146
- "on",
147
- );
148
-
149
- it("should validate QueryDef", () => {
150
- expect(def).toEqual({
151
- type: "switchFk",
152
- table: { database: "TestDb", schema: "TestSchema", name: "User" },
153
- switch: "on",
154
- });
155
- });
156
-
157
- it.each(dialects)("[%s] should validate SQL", (dialect) => {
158
- const builder = createQueryBuilder(dialect);
159
- expect(builder.build(def)).toMatchSql(expected.switchFkOn[dialect]);
160
- });
161
- });
162
-
163
- describe("getSwitchFkQueryDef - off", () => {
164
- const db = createTestDb();
165
- const def = db.getSwitchFkQueryDef(
166
- { database: "TestDb", schema: "TestSchema", name: "User" },
167
- "off",
168
- );
169
-
170
- it("should validate QueryDef", () => {
171
- expect(def).toEqual({
172
- type: "switchFk",
173
- table: { database: "TestDb", schema: "TestSchema", name: "User" },
174
- switch: "off",
175
- });
176
- });
177
-
178
- it.each(dialects)("[%s] should validate SQL", (dialect) => {
179
- const builder = createQueryBuilder(dialect);
180
- expect(builder.build(def)).toMatchSql(expected.switchFkOff[dialect]);
181
- });
182
- });
183
-
184
125
  describe("getDropTableQueryDef", () => {
185
126
  const db = createTestDb();
186
127
  const def = db.getDropTableQueryDef({ database: "TestDb", schema: "TestSchema", name: "User" });
@@ -279,35 +220,6 @@ describe("DDL - Column", () => {
279
220
  });
280
221
  });
281
222
 
282
- describe("getAddColumnQueryDef - with autoIncrement", () => {
283
- const db = createTestDb();
284
- const column = Column.bigint().autoIncrement();
285
- const def = db.getAddColumnQueryDef(
286
- { database: "TestDb", schema: "TestSchema", name: "User" },
287
- "seq",
288
- column,
289
- );
290
-
291
- it("should validate QueryDef", () => {
292
- expect(def).toEqual({
293
- type: "addColumn",
294
- table: { database: "TestDb", schema: "TestSchema", name: "User" },
295
- column: {
296
- name: "seq",
297
- dataType: { type: "bigint" },
298
- autoIncrement: true,
299
- nullable: undefined,
300
- default: undefined,
301
- },
302
- });
303
- });
304
-
305
- it.each(dialects)("[%s] should validate SQL", (dialect) => {
306
- const builder = createQueryBuilder(dialect);
307
- expect(builder.build(def)).toMatchSql(expected.addColumnWithAutoIncrement[dialect]);
308
- });
309
- });
310
-
311
223
  describe("getDropColumnQueryDef", () => {
312
224
  const db = createTestDb();
313
225
  const def = db.getDropColumnQueryDef(
@@ -358,35 +270,6 @@ describe("DDL - Column", () => {
358
270
  });
359
271
  });
360
272
 
361
- describe("getModifyColumnQueryDef - change TYPE + DEFAULT simultaneously", () => {
362
- const db = createTestDb();
363
- const column = Column.int().default(100);
364
- const def = db.getModifyColumnQueryDef(
365
- { database: "TestDb", schema: "TestSchema", name: "User" },
366
- "score",
367
- column,
368
- );
369
-
370
- it("should validate QueryDef", () => {
371
- expect(def).toEqual({
372
- type: "modifyColumn",
373
- table: { database: "TestDb", schema: "TestSchema", name: "User" },
374
- column: {
375
- name: "score",
376
- dataType: { type: "int" },
377
- autoIncrement: undefined,
378
- nullable: undefined,
379
- default: 100,
380
- },
381
- });
382
- });
383
-
384
- it.each(dialects)("[%s] should validate SQL", (dialect) => {
385
- const builder = createQueryBuilder(dialect);
386
- expect(builder.build(def)).toMatchSql(expected.modifyColumnTypeAndDefault[dialect]);
387
- });
388
- });
389
-
390
273
  describe("getRenameColumnQueryDef", () => {
391
274
  const db = createTestDb();
392
275
  const def = db.getRenameColumnQueryDef(
@@ -449,26 +332,6 @@ describe("DDL - Primary Key", () => {
449
332
  });
450
333
  });
451
334
 
452
- describe("getAddPkQueryDef - composite key", () => {
453
- const db = createTestDb();
454
- const def = db.getAddPkQueryDef(
455
- { database: "TestDb", schema: "TestSchema", name: "UserRole" },
456
- ["userId", "roleId"],
457
- );
458
-
459
- it("should validate QueryDef", () => {
460
- expect(def).toEqual({
461
- type: "addPk",
462
- table: { database: "TestDb", schema: "TestSchema", name: "UserRole" },
463
- columns: ["userId", "roleId"],
464
- });
465
- });
466
-
467
- it.each(dialects)("[%s] should validate SQL", (dialect) => {
468
- const builder = createQueryBuilder(dialect);
469
- expect(builder.build(def)).toMatchSql(expected.addPkComposite[dialect]);
470
- });
471
- });
472
335
  });
473
336
 
474
337
  describe("DDL - Foreign Key / Index", () => {
@@ -572,26 +435,6 @@ describe("DDL - Foreign Key / Index", () => {
572
435
  });
573
436
  });
574
437
 
575
- describe("getDropIdxQueryDef - composite", () => {
576
- const db = createTestDb();
577
- const def = db.getDropIdxQueryDef({ database: "TestDb", schema: "TestSchema", name: "User" }, [
578
- "name",
579
- "email",
580
- ]);
581
-
582
- it("should validate QueryDef", () => {
583
- expect(def).toEqual({
584
- type: "dropIdx",
585
- table: { database: "TestDb", schema: "TestSchema", name: "User" },
586
- index: "IDX_User_name_email",
587
- });
588
- });
589
-
590
- it.each(dialects)("[%s] should validate SQL", (dialect) => {
591
- const builder = createQueryBuilder(dialect);
592
- expect(builder.build(def)).toMatchSql(expected.dropIdxComposite[dialect]);
593
- });
594
- });
595
438
  });
596
439
 
597
440
  describe("DDL - View", () => {
@@ -51,20 +51,6 @@ describe("DDL - Column Builder", () => {
51
51
  column,
52
52
  );
53
53
 
54
- it("should validate QueryDef", () => {
55
- expect(def).toEqual({
56
- type: "addColumn",
57
- table: { database: "TestDb", schema: "TestSchema", name: "User" },
58
- column: {
59
- name: "id",
60
- dataType: { type: "bigint" },
61
- autoIncrement: undefined,
62
- nullable: undefined,
63
- default: undefined,
64
- },
65
- });
66
- });
67
-
68
54
  it.each(dialects)("[%s] should validate SQL", (dialect) => {
69
55
  const builder = createQueryBuilder(dialect);
70
56
  expect(builder.build(def)).toMatchSql(expected.bigintType[dialect]);
@@ -82,20 +68,6 @@ describe("DDL - Column Builder", () => {
82
68
  column,
83
69
  );
84
70
 
85
- it("should validate QueryDef", () => {
86
- expect(def).toEqual({
87
- type: "addColumn",
88
- table: { database: "TestDb", schema: "TestSchema", name: "Product" },
89
- column: {
90
- name: "weight",
91
- dataType: { type: "float" },
92
- autoIncrement: undefined,
93
- nullable: undefined,
94
- default: undefined,
95
- },
96
- });
97
- });
98
-
99
71
  it.each(dialects)("[%s] should validate SQL", (dialect) => {
100
72
  const builder = createQueryBuilder(dialect);
101
73
  expect(builder.build(def)).toMatchSql(expected.floatType[dialect]);
@@ -113,20 +85,6 @@ describe("DDL - Column Builder", () => {
113
85
  column,
114
86
  );
115
87
 
116
- it("should validate QueryDef", () => {
117
- expect(def).toEqual({
118
- type: "addColumn",
119
- table: { database: "TestDb", schema: "TestSchema", name: "Product" },
120
- column: {
121
- name: "price",
122
- dataType: { type: "double" },
123
- autoIncrement: undefined,
124
- nullable: undefined,
125
- default: undefined,
126
- },
127
- });
128
- });
129
-
130
88
  it.each(dialects)("[%s] should validate SQL", (dialect) => {
131
89
  const builder = createQueryBuilder(dialect);
132
90
  expect(builder.build(def)).toMatchSql(expected.doubleType[dialect]);
@@ -175,20 +133,6 @@ describe("DDL - Column Builder", () => {
175
133
  column,
176
134
  );
177
135
 
178
- it("should validate QueryDef", () => {
179
- expect(def).toEqual({
180
- type: "addColumn",
181
- table: { database: "TestDb", schema: "TestSchema", name: "User" },
182
- column: {
183
- name: "name",
184
- dataType: { type: "varchar", length: 100 },
185
- autoIncrement: undefined,
186
- nullable: undefined,
187
- default: undefined,
188
- },
189
- });
190
- });
191
-
192
136
  it.each(dialects)("[%s] should validate SQL", (dialect) => {
193
137
  const builder = createQueryBuilder(dialect);
194
138
  expect(builder.build(def)).toMatchSql(expected.varcharType[dialect]);
@@ -237,20 +181,6 @@ describe("DDL - Column Builder", () => {
237
181
  column,
238
182
  );
239
183
 
240
- it("should validate QueryDef", () => {
241
- expect(def).toEqual({
242
- type: "addColumn",
243
- table: { database: "TestDb", schema: "TestSchema", name: "Post" },
244
- column: {
245
- name: "content",
246
- dataType: { type: "text" },
247
- autoIncrement: undefined,
248
- nullable: undefined,
249
- default: undefined,
250
- },
251
- });
252
- });
253
-
254
184
  it.each(dialects)("[%s] should validate SQL", (dialect) => {
255
185
  const builder = createQueryBuilder(dialect);
256
186
  expect(builder.build(def)).toMatchSql(expected.textType[dialect]);
@@ -268,20 +198,6 @@ describe("DDL - Column Builder", () => {
268
198
  column,
269
199
  );
270
200
 
271
- it("should validate QueryDef", () => {
272
- expect(def).toEqual({
273
- type: "addColumn",
274
- table: { database: "TestDb", schema: "TestSchema", name: "File" },
275
- column: {
276
- name: "data",
277
- dataType: { type: "binary" },
278
- autoIncrement: undefined,
279
- nullable: undefined,
280
- default: undefined,
281
- },
282
- });
283
- });
284
-
285
201
  it.each(dialects)("[%s] should validate SQL", (dialect) => {
286
202
  const builder = createQueryBuilder(dialect);
287
203
  expect(builder.build(def)).toMatchSql(expected.binaryType[dialect]);
@@ -299,20 +215,6 @@ describe("DDL - Column Builder", () => {
299
215
  column,
300
216
  );
301
217
 
302
- it("should validate QueryDef", () => {
303
- expect(def).toEqual({
304
- type: "addColumn",
305
- table: { database: "TestDb", schema: "TestSchema", name: "User" },
306
- column: {
307
- name: "isActive",
308
- dataType: { type: "boolean" },
309
- autoIncrement: undefined,
310
- nullable: undefined,
311
- default: undefined,
312
- },
313
- });
314
- });
315
-
316
218
  it.each(dialects)("[%s] should validate SQL", (dialect) => {
317
219
  const builder = createQueryBuilder(dialect);
318
220
  expect(builder.build(def)).toMatchSql(expected.booleanType[dialect]);
@@ -330,20 +232,6 @@ describe("DDL - Column Builder", () => {
330
232
  column,
331
233
  );
332
234
 
333
- it("should validate QueryDef", () => {
334
- expect(def).toEqual({
335
- type: "addColumn",
336
- table: { database: "TestDb", schema: "TestSchema", name: "User" },
337
- column: {
338
- name: "createdAt",
339
- dataType: { type: "datetime" },
340
- autoIncrement: undefined,
341
- nullable: undefined,
342
- default: undefined,
343
- },
344
- });
345
- });
346
-
347
235
  it.each(dialects)("[%s] should validate SQL", (dialect) => {
348
236
  const builder = createQueryBuilder(dialect);
349
237
  expect(builder.build(def)).toMatchSql(expected.datetimeType[dialect]);
@@ -145,58 +145,4 @@ describe("DDL - Index Builder", () => {
145
145
  });
146
146
  });
147
147
 
148
- describe("IndexBuilder - description specified", () => {
149
- const db = createTestDb();
150
- const indexBuilder = IndexFactory.index("email").description("이메일 검색용 인덱스");
151
- const def = db.getAddIdxQueryDef(
152
- { database: "TestDb", schema: "TestSchema", name: "User" },
153
- indexBuilder,
154
- );
155
-
156
- it("should validate QueryDef", () => {
157
- expect(def).toEqual({
158
- type: "addIdx",
159
- table: { database: "TestDb", schema: "TestSchema", name: "User" },
160
- index: {
161
- name: "IDX_User_email",
162
- columns: [{ name: "email", orderBy: "ASC" }],
163
- unique: undefined,
164
- },
165
- });
166
- });
167
-
168
- it.each(dialects)("[%s] should validate SQL", (dialect) => {
169
- const builder = createQueryBuilder(dialect);
170
- expect(builder.build(def)).toMatchSql(expected.singleColumnIndex[dialect]);
171
- });
172
- });
173
-
174
- describe("IndexBuilder - combined options (unique + orderBy)", () => {
175
- const db = createTestDb();
176
- const indexBuilder = IndexFactory.index("name", "email").unique().orderBy("DESC", "ASC");
177
- const def = db.getAddIdxQueryDef(
178
- { database: "TestDb", schema: "TestSchema", name: "User" },
179
- indexBuilder,
180
- );
181
-
182
- it("should validate QueryDef", () => {
183
- expect(def).toEqual({
184
- type: "addIdx",
185
- table: { database: "TestDb", schema: "TestSchema", name: "User" },
186
- index: {
187
- name: "IDX_User_name_email",
188
- columns: [
189
- { name: "name", orderBy: "DESC" },
190
- { name: "email", orderBy: "ASC" },
191
- ],
192
- unique: true,
193
- },
194
- });
195
- });
196
-
197
- it.each(dialects)("[%s] should validate SQL", (dialect) => {
198
- const builder = createQueryBuilder(dialect);
199
- expect(builder.build(def)).toMatchSql(expected.uniqueOrderByIndex[dialect]);
200
- });
201
- });
202
148
  });
@@ -23,54 +23,6 @@ describe("DDL - Procedure Builder", () => {
23
23
  });
24
24
  });
25
25
 
26
- describe("description specified", () => {
27
- const proc = Procedure("TestProc").description("Test procedure");
28
-
29
- it("should validate metadata", () => {
30
- expect(proc.meta).toEqual({
31
- name: "TestProc",
32
- description: "Test procedure",
33
- database: undefined,
34
- schema: undefined,
35
- params: undefined,
36
- returns: undefined,
37
- query: undefined,
38
- });
39
- });
40
- });
41
-
42
- describe("database specified", () => {
43
- const proc = Procedure("TestProc").database("CustomDb");
44
-
45
- it("should validate metadata", () => {
46
- expect(proc.meta).toEqual({
47
- name: "TestProc",
48
- description: undefined,
49
- database: "CustomDb",
50
- schema: undefined,
51
- params: undefined,
52
- returns: undefined,
53
- query: undefined,
54
- });
55
- });
56
- });
57
-
58
- describe("schema specified", () => {
59
- const proc = Procedure("TestProc").schema("CustomSchema");
60
-
61
- it("should validate metadata", () => {
62
- expect(proc.meta).toEqual({
63
- name: "TestProc",
64
- description: undefined,
65
- database: undefined,
66
- schema: "CustomSchema",
67
- params: undefined,
68
- returns: undefined,
69
- query: undefined,
70
- });
71
- });
72
- });
73
-
74
26
  describe("params specified (single parameter)", () => {
75
27
  const proc = Procedure("TestProc").params((c) => ({ id: c.bigint() }));
76
28
 
@@ -82,23 +34,6 @@ describe("DDL - Procedure Builder", () => {
82
34
  });
83
35
  });
84
36
 
85
- describe("params specified (multiple parameters)", () => {
86
- const proc = Procedure("TestProc").params((c) => ({
87
- id: c.bigint(),
88
- name: c.varchar(100),
89
- isActive: c.boolean(),
90
- }));
91
-
92
- it("should validate metadata", () => {
93
- expect(proc.meta.name).toBe("TestProc");
94
- expect(proc.meta.params).toBeDefined();
95
- expect(Object.keys(proc.meta.params!)).toEqual(["id", "name", "isActive"]);
96
- expect(proc.meta.params!.id.meta.dataType).toEqual({ type: "bigint" });
97
- expect(proc.meta.params!.name.meta.dataType).toEqual({ type: "varchar", length: 100 });
98
- expect(proc.meta.params!.isActive.meta.dataType).toEqual({ type: "boolean" });
99
- });
100
- });
101
-
102
37
  describe("returns specified (single return)", () => {
103
38
  const proc = Procedure("TestProc").returns((c) => ({ id: c.bigint() }));
104
39
 
@@ -110,24 +45,6 @@ describe("DDL - Procedure Builder", () => {
110
45
  });
111
46
  });
112
47
 
113
- describe("returns specified (multiple returns)", () => {
114
- const proc = Procedure("TestProc").returns((c) => ({
115
- id: c.bigint(),
116
- name: c.varchar(100),
117
- email: c.varchar(200).nullable(),
118
- }));
119
-
120
- it("should validate metadata", () => {
121
- expect(proc.meta.name).toBe("TestProc");
122
- expect(proc.meta.returns).toBeDefined();
123
- expect(Object.keys(proc.meta.returns!)).toEqual(["id", "name", "email"]);
124
- expect(proc.meta.returns!.id.meta.dataType).toEqual({ type: "bigint" });
125
- expect(proc.meta.returns!.name.meta.dataType).toEqual({ type: "varchar", length: 100 });
126
- expect(proc.meta.returns!.email.meta.dataType).toEqual({ type: "varchar", length: 200 });
127
- expect(proc.meta.returns!.email.meta.nullable).toBe(true);
128
- });
129
- });
130
-
131
48
  describe("body specified + basic DDL generation", () => {
132
49
  const proc = Procedure("TestProc")
133
50
  .database("TestDb")
@@ -208,27 +125,4 @@ describe("DDL - Procedure Builder", () => {
208
125
  });
209
126
  });
210
127
 
211
- describe("method chaining order", () => {
212
- // Same result even with different method chaining order
213
- const proc1 = Procedure("TestProc")
214
- .params((c) => ({ id: c.bigint() }))
215
- .database("TestDb")
216
- .schema("TestSchema")
217
- .body("SELECT 1");
218
-
219
- const proc2 = Procedure("TestProc")
220
- .database("TestDb")
221
- .schema("TestSchema")
222
- .params((c) => ({ id: c.bigint() }))
223
- .body("SELECT 1");
224
-
225
- it("should validate metadata consistency", () => {
226
- // params is an object so deep comparison is needed
227
- expect(proc1.meta.name).toBe(proc2.meta.name);
228
- expect(proc1.meta.database).toBe(proc2.meta.database);
229
- expect(proc1.meta.schema).toBe(proc2.meta.schema);
230
- expect(proc1.meta.query).toBe(proc2.meta.query);
231
- expect(Object.keys(proc1.meta.params!)).toEqual(Object.keys(proc2.meta.params!));
232
- });
233
- });
234
128
  });