Skip to content
This repository has been archived by the owner on Feb 26, 2018. It is now read-only.

Commit

Permalink
Merge 7578281 into df05792
Browse files Browse the repository at this point in the history
  • Loading branch information
greenkeeper[bot] committed Jul 5, 2017
2 parents df05792 + 7578281 commit 48bc856
Show file tree
Hide file tree
Showing 6 changed files with 357 additions and 409 deletions.
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
services:
- docker
services: docker

before_install:
- yarn global add greenkeeper-lockfile@1
- pip install docker-compose

before_script: greenkeeper-lockfile-update

script:
- docker-compose -f docker-compose-tests.yml build travis-tests
- docker-compose -f docker-compose-tests.yml run travis-tests

after_script:
- docker-compose -f docker-compose-tests.yml down -v
- greenkeeper-lockfile-upload

after_success:
- bash ./scripts/ci-deployment/deploy.sh
after_success: bash ./scripts/ci-deployment/deploy.sh
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# GP redirect

[![Greenkeeper badge](https://badges.greenkeeper.io/nhsuk/gp-redirect.svg)](https://greenkeeper.io/)

[![Build Status](https://travis-ci.org/nhsuk/gp-redirect.svg?branch=master)](https://travis-ci.org/nhsuk/gp-redirect)
[![Coverage Status](https://coveralls.io/repos/github/nhsuk/gp-redirect/badge.svg?branch=master)](https://coveralls.io/github/nhsuk/gp-redirect?branch=master)
[![Known Vulnerabilities](https://snyk.io/test/github/nhsuk/gp-redirect/badge.svg)](https://snyk.io/test/github/nhsuk/gp-redirect)
Expand Down
4 changes: 2 additions & 2 deletions lib/rewriteUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ function interpolateIdIfAvailable(urlToParse) {

function rewriteUrl(urlToRewrite) {
return ifUrlIsFromGpProfiles(urlToRewrite)
? interpolateIdIfAvailable(urlToRewrite)
: undefined;
? interpolateIdIfAvailable(urlToRewrite)
: undefined;
}

module.exports = rewriteUrl;
18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,24 @@
"url": "git+https://github.com/nhsuk/gp-redirect.git"
},
"dependencies": {
"eslint-config-nhsuk": "^0.2.0",
"express": "^4.15.3",
"nhsuk-bunyan-logger": "^1.4.0"
},
"devDependencies": {
"chai": "^4.0.2",
"chai-http": "^3.0.0",
"coveralls": "^2.13.1",
"eslint": "^3.18.0",
"eslint-config-airbnb": "^15.0.1",
"eslint-plugin-import": "^2.3.0",
"eslint": "^4.1.1",
"eslint-config-airbnb-base": "^11.2.0",
"eslint-config-nhsuk": "^0.3.0",
"eslint-plugin-import": "^2.6.1",
"eslint-plugin-json": "^1.2.0",
"eslint-plugin-jsx-a11y": "^5.0.3",
"eslint-plugin-mocha": "^4.10.1",
"eslint-plugin-react": "^7.1.0",
"eslint-watch": "^3.1.1",
"husky": "^0.13.4",
"eslint-plugin-mocha": "^4.11.0",
"eslint-watch": "^3.1.2",
"husky": "^0.14.2",
"istanbul": "^0.4.5",
"mocha": "^3.4.2",
"nodemon": "^1.11.0",
"snyk": "^1.34.4"
"snyk": "^1.36.2"
}
}
64 changes: 32 additions & 32 deletions test/integration/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,52 +15,52 @@ describe('app', () => {

it('should redirect root requests to the SITE_ROOT', (done) => {
chai.request(app)
.get('/')
.end((err, res) => {
.get('/')
.end((err, res) => {
// eslint-disable-next-line no-unused-expressions
expect(res).to.redirect;
expect(res.redirects[0]).to.have.string(SITE_ROOT);
expect(res).to.have.status(200);
done();
});
expect(res).to.redirect;
expect(res.redirects[0]).to.have.string(SITE_ROOT);
expect(res).to.have.status(200);
done();
});
});

it('should redirect to the new gp profile page when referer comes from gp on choices', (done) => {
chai.request(app)
.get(SITE_ROOT)
.set('referer', choicesGpPage)
.end((err, res) => {
.get(SITE_ROOT)
.set('referer', choicesGpPage)
.end((err, res) => {
// eslint-disable-next-line no-unused-expressions
expect(res).to.redirect;
expect(res).to.redirectTo(redirectedToUrl);
done();
});
expect(res).to.redirect;
expect(res).to.redirectTo(redirectedToUrl);
done();
});
});

it('should display the options page when no referer is available', (done) => {
chai.request(app)
.get(SITE_ROOT)
.end((err, res) => {
.get(SITE_ROOT)
.end((err, res) => {
// eslint-disable-next-line no-unused-expressions
expect(res).to.be.html;
expect(res).to.have.status(200);
done();
});
expect(res).to.be.html;
expect(res).to.have.status(200);
done();
});
});

it('should display debug json when debug param supplied', (done) => {
chai.request(app)
.get(SITE_ROOT)
.set('referer', choicesGpPage)
.query({ debug: '' })
.end((err, res) => {
expect(res).to.have.status(200);
// eslint-disable-next-line no-unused-expressions
expect(res).to.be.json;
// eslint-disable-next-line no-unused-expressions
expect(res.body.headers).to.not.be.undefined;
expect(res.body.redirectTo).to.be.equal(redirectedToUrl);
done();
});
.get(SITE_ROOT)
.set('referer', choicesGpPage)
.query({ debug: '' })
.end((err, res) => {
expect(res).to.have.status(200);
// eslint-disable-next-line no-unused-expressions
expect(res).to.be.json;
// eslint-disable-next-line no-unused-expressions
expect(res.body.headers).to.not.be.undefined;
expect(res.body.redirectTo).to.be.equal(redirectedToUrl);
done();
});
});
});
Loading

0 comments on commit 48bc856

Please sign in to comment.