File tree Expand file tree Collapse file tree 2 files changed +13
-22
lines changed Expand file tree Collapse file tree 2 files changed +13
-22
lines changed Original file line number Diff line number Diff line change 11import { getRecords } from 'Components/db' ;
22import config from 'Config' ;
33
4- if ( process . env . NODE_ENV == 'test' ) require ( 'dotenv' ) . config ( ) ;
4+ require ( 'dotenv' ) . config ( ) ;
55
66describe ( 'db tests' , ( ) => {
7- test ( 'do search and find records' , async ( ) => {
8- console . log ( process . env ) ;
9- console . log ( process . env . CODEMASH_SECRET_KEY ) ;
10- console . log ( process . env . CODEMASH_PROJECT_ID ) ;
11-
7+ beforeEach ( ( ) => {
128 config . init (
139 {
14- secretKey : 'GGzMupRM7upe9HPsZnrtWeOx-0AMF9UI' ,
15- projectId : 'fe964bc0-3475-4ac2-81a9-2a3abdaf614b' ,
10+ secretKey : process . env . CODEMASH_SECRET_KEY ,
11+ projectId : process . env . CODEMASH_PROJECT_ID ,
1612 } ,
1713 process . env . NODE_ENV
1814 ) ;
15+ } ) ;
16+
17+ test ( 'do search and find records' , async ( ) => {
1918 const request = { collectionName : 'contacts' } ;
2019 const response = await getRecords ( request ) ;
2120 expect ( response . totalCount ) . toBe ( 2 ) ;
Original file line number Diff line number Diff line change 11import { uploadFile } from 'Components/files' ;
22import config from 'Config' ;
33
4- if ( process . env . NODE_ENV == 'test' ) require ( 'dotenv' ) . config ( ) ;
4+ require ( 'dotenv' ) . config ( ) ;
55
66var FormData = require ( 'form-data' ) ;
77const fs = require ( 'fs' ) ;
88
99describe ( 'file tests' , ( ) => {
10- beforeEach ( ( ) => { } ) ;
11-
12- test ( 'upload file as base 64' , async ( ) => {
10+ beforeEach ( ( ) => {
1311 config . init (
1412 {
15- secretKey : 'GGzMupRM7upe9HPsZnrtWeOx-0AMF9UI' ,
16- projectId : 'fe964bc0-3475-4ac2-81a9-2a3abdaf614b' ,
13+ secretKey : process . env . CODEMASH_SECRET_KEY ,
14+ projectId : process . env . CODEMASH_PROJECT_ID ,
1715 } ,
1816 process . env . NODE_ENV
1917 ) ;
18+ } ) ;
2019
20+ test ( 'upload file as base 64' , async ( ) => {
2121 const txtFile = fs . readFileSync ( 'tests/files/uploads/document.txt' , {
2222 encoding : 'base64' ,
2323 } ) ;
@@ -32,14 +32,6 @@ describe('file tests', () => {
3232 } ) ;
3333
3434 test ( 'upload file' , async ( ) => {
35- config . init (
36- {
37- secretKey : process . env . CODEMASH_SECRET_KEY ,
38- projectId : process . env . CODEMASH_PROJECT_ID ,
39- } ,
40- process . env . NODE_ENV
41- ) ;
42-
4335 const txtFile = fs . createReadStream ( 'tests/files/uploads/document.txt' ) ;
4436
4537 const request = {
You can’t perform that action at this time.
0 commit comments