Skip to content

Commit

Permalink
refactor(builder) Minor formatting of specs
Browse files Browse the repository at this point in the history
  • Loading branch information
LFDM committed Aug 3, 2017
1 parent be9606c commit 561d3bd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/builder.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe('builder', () => {
.then(() => api.user.getUsers())
.then(expectOnlyOneApiCall);
});

it('Two read api calls will return the same output', (done) => {
const myConfig = config();
myConfig.user.api.getUsers = sinon.spy(myConfig.user.api.getUsers);
Expand All @@ -70,6 +71,7 @@ describe('builder', () => {
.then(() => api.user.getUsers())
.then(expectOnlyOneApiCall);
});

it('1000 calls is not slow', (done) => {
const myConfig = config();
myConfig.user.api.getUsers = sinon.spy(myConfig.user.api.getUsers);
Expand All @@ -87,6 +89,7 @@ describe('builder', () => {
}
bc.then(checkTimeConstraint);
});

it('Works with non default id set', (done) => {
const myConfig = config();
myConfig.__config = {idField: 'mySecretId', useProductionBuild: true};
Expand All @@ -106,6 +109,7 @@ describe('builder', () => {
.then(() => api.user.getUsers())
.then(expectOnlyOneApiCall);
});

it('Delete removes value from cached array', (done) => {
const myConfig = config();
myConfig.user.api.getUsers = sinon.spy(() => Promise.resolve([{id: 1}, {id: 2}]));
Expand All @@ -122,6 +126,7 @@ describe('builder', () => {
.then(() => api.user.getUsers())
.then(expectUserToBeRemoved);
});

it('TTL set to zero means we never get a cache hit', (done) => {
const myConfig = config();
myConfig.user.ttl = 0;
Expand Down

0 comments on commit 561d3bd

Please sign in to comment.