Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1005 from 18F/release-1.14
Browse files Browse the repository at this point in the history
Relase 1.14.0
  • Loading branch information
Marco Segreto authored Feb 9, 2017
2 parents 64e5fee + dac1a7f commit ac08f03
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloudgov-dashboard",
"version": "1.13.4",
"version": "1.14.0",
"engines": {
"node": "6.x.x",
"npm": "3.x.x"
Expand Down
9 changes: 8 additions & 1 deletion static_src/actions/org_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ const orgActions = {
});

return cfApi.fetchOrgs()
.then(orgs => Promise.all(orgs.map(o => cfApi.fetchOrgSummary(o.guid))))
.then(orgs =>
Promise.all(
orgs.map(
org =>
cfApi.fetchOrgSummary(org.guid).then(summary => Object.assign({}, org, summary))
)
)
)
.then(orgActions.receivedOrgs);
},

Expand Down
15 changes: 13 additions & 2 deletions static_src/test/unit/actions/org_actions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ describe('orgActions', () => {
});

describe('fetchAll()', function () {
let viewSpy;
let viewSpy, spaces;

beforeEach(function (done) {
spaces = [{ guid: 'space-123' }, { guid: 'space-abc' }];
viewSpy = setupViewSpy(sandbox);
sandbox.stub(orgActions, 'receivedOrgs').returns(Promise.resolve());
sandbox.stub(cfApi, 'fetchOrgs').returns(Promise.resolve([{ guid: '1234' }]));
sandbox.stub(cfApi, 'fetchOrgSummary').returns(Promise.resolve());
sandbox.stub(cfApi, 'fetchOrgSummary').returns(Promise.resolve({ spaces }));

orgActions.fetchAll().then(done, done.fail);
});
Expand All @@ -70,6 +71,16 @@ describe('orgActions', () => {
it('calls receivedOrgs action', function () {
expect(orgActions.receivedOrgs).toHaveBeenCalledOnce();
});

it('fetches org summary data for each org', function () {
expect(cfApi.fetchOrgSummary).toHaveBeenCalledOnce();
});

it('merges summary data with org', function () {
const [orgs] = orgActions.receivedOrgs.getCall(0).args;
const [org] = orgs;
expect(org).toEqual({ guid: '1234', spaces });
});
});

describe('receivedOrg()', function () {
Expand Down

0 comments on commit ac08f03

Please sign in to comment.