@@ -12,12 +12,12 @@ describe('operations', () => {
12
12
expect ( createTableFn ) . toBeTypeOf ( 'function' ) ;
13
13
} ) ;
14
14
15
- // TODO @Shinigami 92 2024-03-12: This should throw an error when columns are empty
16
- it ( 'should return sql statement' , ( ) => {
17
- const statement = createTableFn ( 'films' , { } ) ;
18
-
19
- expect ( statement ) . toBeTypeOf ( 'string' ) ;
20
- expect ( statement ) . toBe ( 'CREATE TABLE "films" (\n \n);' ) ;
15
+ it ( ' should throw error when no columns, constraints, or LIKE clause are provided' , ( ) => {
16
+ expect ( ( ) => createTableFn ( 'films' , { } ) ) . toThrow (
17
+ new Error (
18
+ 'No columns, constraints, or LIKE clause provided for createTable'
19
+ )
20
+ ) ;
21
21
} ) ;
22
22
23
23
it ( 'should return sql statement with tableOptions' , ( ) => {
@@ -54,18 +54,20 @@ describe('operations', () => {
54
54
) ;
55
55
} ) ;
56
56
57
- // TODO @Shinigami 92 2024-03-12: This should throw an error when columns are empty
58
- it ( 'should return sql statement with schema' , ( ) => {
59
- const statement = createTableFn (
60
- {
61
- name : 'films' ,
62
- schema : 'myschema' ,
63
- } ,
64
- { }
57
+ it ( 'should throw error when no columns, constraints, or LIKE clause are provided (with schema)' , ( ) => {
58
+ expect ( ( ) =>
59
+ createTableFn (
60
+ {
61
+ name : 'films' ,
62
+ schema : 'myschema' ,
63
+ } ,
64
+ { }
65
+ )
66
+ ) . toThrow (
67
+ new Error (
68
+ 'No columns, constraints, or LIKE clause provided for createTable'
69
+ )
65
70
) ;
66
-
67
- expect ( statement ) . toBeTypeOf ( 'string' ) ;
68
- expect ( statement ) . toBe ( 'CREATE TABLE "myschema"."films" (\n \n);' ) ;
69
71
} ) ;
70
72
71
73
it . each ( [
0 commit comments