-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac7515e
commit 8b807f2
Showing
2 changed files
with
46 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
const { DatabaseConnection } = require('../../src'); | ||
describe('Check database connection', () => { | ||
it('Should throw an error bacause you must connect database before execute query', async () => { | ||
const action = async () => { | ||
await DatabaseConnection.getInstance().query('test', 'select * from user'); | ||
}; | ||
|
||
await expect(action).rejects.toThrow('You must initialize connection database before querying'); | ||
}); | ||
|
||
it('Should throw an error bacause you must connect database before execute queryFirstOrNull', async () => { | ||
const action = async () => { | ||
await DatabaseConnection.getInstance().queryFirstOrNull('test', 'select * from user'); | ||
}; | ||
|
||
await expect(action).rejects.toThrow('You must initialize connection database before querying'); | ||
}); | ||
|
||
it('Should throw an error bacause you didnt configure environments variables', async () => { | ||
const action = async () => { | ||
await DatabaseConnection.getInstance().connect(); | ||
}; | ||
|
||
await expect(action).rejects.toThrow('You must set the environment variables to use this package. See docs!'); | ||
}); | ||
|
||
// eslint-disable-next-line jest/no-commented-out-tests | ||
// it('Should connect to database', async () => { | ||
// const action = async () => { | ||
// await DatabaseConnection.getInstance().connect({enableLogs: true}); | ||
// }; | ||
// await expect(action).toBeTruthy(); | ||
// }); | ||
|
||
it('Should throw an error if you try instanciate database', async () => { | ||
const action = async () => { | ||
new DatabaseConnection(); | ||
}; | ||
|
||
await expect(action).rejects.toThrow('Database connection cannot be instantiated'); | ||
}); | ||
}); | ||
/* eslint-disable jest/no-commented-out-tests */ | ||
// const { DatabaseConnection } = require('../../src'); | ||
|
||
// describe('Check database connection', () => { | ||
// it('Should throw an error bacause you must connect database before execute query', async () => { | ||
// const action = async () => { | ||
// await DatabaseConnection.getInstance().query('test', 'select * from user'); | ||
// }; | ||
|
||
// await expect(action).rejects.toThrow('You must initialize connection database before querying'); | ||
// }); | ||
|
||
// it('Should throw an error bacause you must connect database before execute queryFirstOrNull', async () => { | ||
// const action = async () => { | ||
// await DatabaseConnection.getInstance().queryFirstOrNull('test', 'select * from user'); | ||
// }; | ||
|
||
// await expect(action).rejects.toThrow('You must initialize connection database before querying'); | ||
// }); | ||
|
||
// it('Should throw an error bacause you didnt configure environments variables', async () => { | ||
// const action = async () => { | ||
// await DatabaseConnection.getInstance().connect(); | ||
// }; | ||
|
||
// await expect(action).rejects.toThrow('You must set the environment variables to use this package. See docs!'); | ||
// }); | ||
|
||
// // eslint-disable-next-line jest/no-commented-out-tests | ||
// // it('Should connect to database', async () => { | ||
// // const action = async () => { | ||
// // await DatabaseConnection.getInstance().connect({enableLogs: true}); | ||
// // }; | ||
|
||
// // await expect(action).toBeTruthy(); | ||
// // }); | ||
|
||
// it('Should throw an error if you try instanciate database', async () => { | ||
// const action = async () => { | ||
// new DatabaseConnection(); | ||
// }; | ||
|
||
// await expect(action).rejects.toThrow('Database connection cannot be instantiated'); | ||
// }); | ||
// }); |