File tree Expand file tree Collapse file tree 10 files changed +68
-5
lines changed
Expand file tree Collapse file tree 10 files changed +68
-5
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ The system uses a **"Directory-as-Datasource"** convention to map objects to dat
2929│ └── users.object.yml # [Datasource: default] (Root level = default)
3030│
3131├── /roles # RBAC Definitions
32- └── .objectqlrc .js # Connection config (Environment specific)
32+ └── objectql.config .js # Connection config (Environment specific)
3333```
3434
3535### 2.2 Resolution Priority
@@ -38,7 +38,7 @@ The system uses a **"Directory-as-Datasource"** convention to map objects to dat
38382 . ** Implicit:** Subdirectory name under ` /objects/ ` .
39393 . ** Fallback:** ` default ` connection.
4040
41- ### 2.3 Connection Configuration (` .objectqlrc .js` )
41+ ### 2.3 Connection Configuration (` objectql.config .js` )
4242
4343This file exports the configuration for all valid datasources. The ` default ` datasource is required.
4444
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ preset : 'ts-jest' ,
3+ testEnvironment : 'node' ,
4+ testMatch : [ '**/test/**/*.test.ts' ] ,
5+ } ;
Original file line number Diff line number Diff line change 55 "types" : " dist/index.d.ts" ,
66 "scripts" : {
77 "build" : " tsc" ,
8- "test" : " echo \" No tests specified \" && exit 0 "
8+ "test" : " jest "
99 },
1010 "dependencies" : {
1111 "@objectql/core" : " ^0.1.0" ,
Original file line number Diff line number Diff line change 1+ import { KnexDriver } from '../src' ;
2+ import knex from 'knex' ;
3+
4+ jest . mock ( 'knex' , ( ) => {
5+ return jest . fn ( ( ) => ( {
6+ // Mock knex instance methods if needed
7+ } ) ) ;
8+ } ) ;
9+
10+ describe ( 'KnexDriver' , ( ) => {
11+ it ( 'should be instantiable' , ( ) => {
12+ const driver = new KnexDriver ( { client : 'sqlite3' } ) ;
13+ expect ( driver ) . toBeDefined ( ) ;
14+ expect ( driver ) . toBeInstanceOf ( KnexDriver ) ;
15+ } ) ;
16+ } ) ;
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ preset : 'ts-jest' ,
3+ testEnvironment : 'node' ,
4+ testMatch : [ '**/test/**/*.test.ts' ] ,
5+ } ;
Original file line number Diff line number Diff line change 55 "types" : " dist/index.d.ts" ,
66 "scripts" : {
77 "build" : " tsc" ,
8- "test" : " echo \" No tests specified \" && exit 0 "
8+ "test" : " jest "
99 },
1010 "dependencies" : {
1111 "@objectql/core" : " ^0.1.0" ,
Original file line number Diff line number Diff line change 1+ import { MongoDriver } from '../src' ;
2+ import { MongoClient } from 'mongodb' ;
3+
4+ jest . mock ( 'mongodb' , ( ) => {
5+ return {
6+ MongoClient : jest . fn ( ) . mockImplementation ( ( ) => ( {
7+ connect : jest . fn ( ) . mockResolvedValue ( undefined ) ,
8+ db : jest . fn ( ) . mockReturnValue ( { } ) ,
9+ } ) ) ,
10+ } ;
11+ } ) ;
12+
13+ describe ( 'MongoDriver' , ( ) => {
14+ it ( 'should be instantiable' , ( ) => {
15+ const driver = new MongoDriver ( { url : 'mongodb://localhost:27017' } ) ;
16+ expect ( driver ) . toBeDefined ( ) ;
17+ expect ( driver ) . toBeInstanceOf ( MongoDriver ) ;
18+ } ) ;
19+ } ) ;
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ preset : 'ts-jest' ,
3+ testEnvironment : 'node' ,
4+ testMatch : [ '**/test/**/*.test.ts' ] ,
5+ } ;
Original file line number Diff line number Diff line change 55 "types" : " dist/index.d.ts" ,
66 "scripts" : {
77 "build" : " tsc" ,
8- "test" : " echo \" No tests specified \" && exit 0 "
8+ "test" : " jest "
99 },
1010 "dependencies" : {
1111 "@objectql/core" : " ^0.1.0" ,
Original file line number Diff line number Diff line change 1+ import { createObjectQLRouter } from '../src' ;
2+ import { IObjectQL } from '@objectql/core' ;
3+ import express from 'express' ;
4+
5+ describe ( 'createObjectQLRouter' , ( ) => {
6+ it ( 'should create a router' , ( ) => {
7+ const mockObjectQL = { } as IObjectQL ;
8+ const router = createObjectQLRouter ( { objectql : mockObjectQL } ) ;
9+ expect ( router ) . toBeDefined ( ) ;
10+ // Router is a function in Express
11+ expect ( typeof router ) . toBe ( 'function' ) ;
12+ } ) ;
13+ } ) ;
You can’t perform that action at this time.
0 commit comments