-
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
Showing
7 changed files
with
210 additions
and
48 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import chai from 'chai'; | ||
const expect = chai.expect; | ||
|
||
import chaiAsPromised from 'chai-as-promised'; | ||
import dirtyChai from 'dirty-chai'; | ||
import chaiFs from 'chai-fs'; | ||
|
||
import axios from 'axios'; | ||
import sinon, { SinonStub } from 'sinon'; | ||
|
||
// tslint:disable-next-line: import-name | ||
import Config from './config'; | ||
// tslint:disable-next-line: import-name | ||
import Serapay, { IConfig } from './serapay'; | ||
|
||
chai.use(chaiAsPromised); | ||
chai.use(dirtyChai); | ||
chai.use(chaiFs); | ||
|
||
describe('Serapay class', () => { | ||
let config: Config; | ||
let serapay: Serapay; | ||
|
||
before(() => { | ||
const defaultConfig = { | ||
baseURL: 'http://private-38e18c-uzduotis.apiary-mock.com/', | ||
headers: { | ||
get: { | ||
Accept: 'application/json', | ||
}, | ||
}, | ||
}; | ||
config = new Config(defaultConfig); | ||
serapay = new Serapay(config); | ||
}); | ||
|
||
it('start method should throw error for empty path', () => { | ||
const path = './data/input.json'; | ||
//expect(() => serapay.start('')).to.throw(); | ||
expect(path).to.be.a.file().with.json(); | ||
expect(() => serapay.start(path)).to.not.throw(); | ||
}); | ||
|
||
xit('getConfig should return IConfig', async () => { | ||
const cfg: IConfig = await serapay.getConfig(); | ||
expect(cfg).to.have.property('cashIn'); | ||
expect(cfg).to.have.property('cashOutNatural'); | ||
expect(cfg).to.have.property('cashOutJuridical'); | ||
|
||
expect(cfg.cashIn).to.have.property('percents'); | ||
expect(cfg.cashIn).to.have.property('max'); | ||
expect(cfg.cashIn.max).to.have.property('amount'); | ||
expect(cfg.cashIn.max).to.have.property('currency'); | ||
|
||
expect(cfg.cashOutNatural).to.have.property('percents'); | ||
expect(cfg.cashOutNatural).to.have.property('week_limit'); | ||
expect(cfg.cashOutNatural.week_limit).to.have.property('amount'); | ||
expect(cfg.cashOutNatural.week_limit).to.have.property('currency'); | ||
|
||
expect(cfg.cashOutJuridical).to.have.property('percents'); | ||
expect(cfg.cashOutJuridical).to.have.property('min'); | ||
expect(cfg.cashOutJuridical.min).to.have.property('amount'); | ||
expect(cfg.cashOutJuridical.min).to.have.property('currency'); | ||
}); | ||
|
||
|
||
}); |
Oops, something went wrong.