Skip to content

Commit

Permalink
add test for treasure
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoosilva committed Dec 18, 2020
1 parent c07bf67 commit 74c46b5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ test.serial('invalid-dates', async t => {
const errorGetStockHistory = await t.throwsAsync(async () => t.context.ceiCrawler.getStockHistory(new Date(0), new Date(10000)));
const errorGetDividends = await t.throwsAsync(async () => t.context.ceiCrawler.getDividends(new Date(0)));
const errorGetWallet = await t.throwsAsync(async () => t.context.ceiCrawler.getWallet(new Date(0)));
const errorGetTreasure = await t.throwsAsync(async () => t.context.ceiCrawler.getTreasures(new Date(0)));

t.true(errorGetStockHistory.type === CeiErrorTypes.SUBMIT_ERROR);
t.true(errorGetDividends.type === CeiErrorTypes.SUBMIT_ERROR);
t.true(errorGetWallet.type === CeiErrorTypes.SUBMIT_ERROR);
t.true(errorGetTreasure.type === CeiErrorTypes.SUBMIT_ERROR);
});

test.serial('stock-history-invalid-dates-with-cap-on', async t => {
Expand All @@ -80,6 +82,12 @@ test.serial('wallet', async t => {
t.true(result.length > 0);
});

test.serial('treasure', async t => {
const nextWeek = new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 7);
const result = await t.context.ceiCrawlerCap.getTreasures(nextWeek);
t.true(result.length > 0);
});

test.serial('stockHistoryOptions', async t => {
const result = await t.context.ceiCrawlerCap.getStockHistoryOptions();
t.true(result.minDate.length > 0);
Expand All @@ -95,6 +103,11 @@ test.serial('dividendsOptions', async t => {
t.true(result.minDate.length > 0);
});

test.serial('treasureOptions', async t => {
const result = await t.context.ceiCrawlerCap.getTreasureOptions();
t.true(result.institutions.length > 0);
});

test.serial('login-fail', async t => {
const error = await t.throwsAsync(async () => {
const wrongCeiCrawler = new CeiCrawler('1234', 'invalidPassword');
Expand Down

0 comments on commit 74c46b5

Please sign in to comment.