Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Evheniy Bystrov committed Feb 27, 2017
1 parent 896dfed commit d28921a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('Offline first storage', () => {

const data = await ofs.getData();

await pause(10);
await pause(100);

expect(isGetDataFromCache).is.true;
expect(isGetDataFromSource).is.true;
Expand Down Expand Up @@ -134,10 +134,11 @@ describe('Offline first storage', () => {
});

await redis.set(key, 'test');
await redis.set(`date_${key}`, timeNow);

const data = await ofs.getData();

await pause(10);
await pause(100);

expect(isGetDataFromCache).is.true;
expect(isGetDataFromSource).is.true;
Expand All @@ -158,6 +159,7 @@ describe('Offline first storage', () => {
const timeNow = new Date().valueOf().toString(10);

await redis.set(key, 'test');
await redis.set(`date_${key}`, timeNow);

const ofs = new OFS({
async getDataFromSource() {
Expand All @@ -184,11 +186,9 @@ describe('Offline first storage', () => {
ttl: 10000,
});

await redis.set(`date_${key}`, timeNow);

const data = await ofs.getData();

await pause(10);
await pause(100);

expect(isGetDataFromCache).is.true;
expect(isGetDataFromSource).is.false;
Expand All @@ -209,6 +209,7 @@ describe('Offline first storage', () => {
const timeNow = new Date().valueOf().toString(10);

await redis.set(key, 'test');
await redis.set(`date_${key}`, timeNow);

const ofs = new OFS({
async getDataFromSource() {
Expand All @@ -235,11 +236,9 @@ describe('Offline first storage', () => {
ttl: 0,
});

await redis.set(`date_${key}`, timeNow);

const data = await ofs.getData();

await pause(10);
await pause(100);

expect(isGetDataFromCache).is.true;
expect(isGetDataFromSource).is.true;
Expand Down

0 comments on commit d28921a

Please sign in to comment.