-
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.
Merge pull request #104 from ciatph/dev
v1.3.6
- Loading branch information
Showing
15 changed files
with
290 additions
and
252 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
require('dotenv').config() | ||
const path = require('path') | ||
|
||
const ExcelFile = require('../../src/classes/excel') | ||
const ExcelFactory = require('../../src/classes/excelfactory') | ||
const ColorLog = require('../../src/classes/colorlog') | ||
const logger = new ColorLog({ isBold: true }) | ||
|
||
const checkClass = require('./checkClass') | ||
const config = require('./config.json') | ||
|
||
// Classes loading the default local 10-day Excel file using a custom regions config | ||
const LOCAL_SOURCE = { | ||
excelFactory: new ExcelFactory({ settings: config }), | ||
|
||
excelFile: new ExcelFile({ | ||
pathToFile: path.join(__dirname, '..', '..', 'data', 'day1.xlsx'), | ||
settings: config | ||
}) | ||
} | ||
|
||
// Classes loading the remote 10-day Excel file using a custom regions config | ||
const REMOTE_SOURCE = { | ||
excelFile: new ExcelFile({ | ||
pathToFile: path.join(__dirname, 'excelfiledownload5.xlsx'), | ||
url: process.env.EXCEL_FILE_URL, | ||
settings: config | ||
}), | ||
|
||
excelFactory: new ExcelFactory({ | ||
url: process.env.EXCEL_FILE_URL, | ||
settings: config | ||
}) | ||
} | ||
|
||
/* eslint-disable no-undef */ | ||
describe('Class intialization using CUSTOM config', () => { | ||
beforeAll(async () => { | ||
return await Promise.all([ | ||
REMOTE_SOURCE.excelFile.init(), | ||
REMOTE_SOURCE.excelFactory.init() | ||
]) | ||
}) | ||
|
||
it('should load LOCAL_SOURCE Excel file', () => { | ||
jest.setTimeout(40000) | ||
logger.log('[INIT]: Started loading using "CUSTOM" config on LOCAL file') | ||
|
||
checkClass({ | ||
excelInstance: LOCAL_SOURCE.excelFactory, | ||
classType: ExcelFactory | ||
}) | ||
|
||
checkClass({ | ||
excelInstance: LOCAL_SOURCE.excelFile, | ||
classType: ExcelFile | ||
}) | ||
}) | ||
|
||
it('should load REMOTE_SOURCE Excel file', async () => { | ||
jest.setTimeout(20000) | ||
logger.log('[INIT]: Started loading using "CUSTOM" config on REMOTE file') | ||
|
||
checkClass({ | ||
excelInstance: REMOTE_SOURCE.excelFactory, | ||
isRemote: true, | ||
classType: ExcelFactory | ||
}) | ||
|
||
checkClass({ | ||
excelInstance: REMOTE_SOURCE.excelFile, | ||
isRemote: true, | ||
classType: ExcelFile | ||
}) | ||
}) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
require('dotenv').config() | ||
const path = require('path') | ||
|
||
const ExcelFile = require('../../src/classes/excel') | ||
const ExcelFactory = require('../../src/classes/excelfactory') | ||
const ColorLog = require('../../src/classes/colorlog') | ||
const logger = new ColorLog({ isBold: true }) | ||
|
||
const checkClass = require('./checkClass') | ||
|
||
// Classes loading the default local 10-day Excel file using the default PAGASA seasonal config | ||
const LOCAL_SOURCE = { | ||
excelFactory: new ExcelFactory(), | ||
|
||
excelFile: new ExcelFile({ | ||
pathToFile: path.join(__dirname, '..', '..', 'data', 'day1.xlsx') | ||
}) | ||
} | ||
|
||
// Classes loading the remote 10-day Excel file using the default PAGASA seasonal config | ||
const REMOTE_SOURCE = { | ||
excelFile: new ExcelFile({ | ||
pathToFile: path.join(__dirname, 'excelfiledownload4.xlsx'), | ||
url: process.env.EXCEL_FILE_URL | ||
}), | ||
|
||
excelFactory: new ExcelFactory({ | ||
url: process.env.EXCEL_FILE_URL | ||
}) | ||
} | ||
|
||
/* eslint-disable no-undef */ | ||
describe('Class intialization using DEFAULT config', () => { | ||
beforeAll(async () => { | ||
return await Promise.all([ | ||
REMOTE_SOURCE.excelFile.init(), | ||
REMOTE_SOURCE.excelFactory.init() | ||
]) | ||
}) | ||
|
||
it('should load LOCAL_SOURCE Excel file', () => { | ||
jest.setTimeout(40000) | ||
logger.log('[INIT]: Started loading using "DEFAULT" config on LOCAL file') | ||
|
||
checkClass({ | ||
excelInstance: LOCAL_SOURCE.excelFactory, | ||
classType: ExcelFactory | ||
}) | ||
|
||
checkClass({ | ||
excelInstance: LOCAL_SOURCE.excelFile, | ||
classType: ExcelFile | ||
}) | ||
}) | ||
|
||
it('should load REMOTE_SOURCE Excel file', async () => { | ||
jest.setTimeout(20000) | ||
logger.log('[INIT]: Started loading using "DEFAULT" config on REMOTE file') | ||
|
||
checkClass({ | ||
excelInstance: REMOTE_SOURCE.excelFactory, | ||
isRemote: true, | ||
classType: ExcelFactory | ||
}) | ||
|
||
checkClass({ | ||
excelInstance: REMOTE_SOURCE.excelFile, | ||
isRemote: true, | ||
classType: ExcelFile | ||
}) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.