Skip to content

Commit

Permalink
Merge pull request #37 from bbc/NEWSART-546-serve-articles-data
Browse files Browse the repository at this point in the history
Statically serve files in /data
  • Loading branch information
jtart committed Jun 6, 2018
2 parents dcb17fd + 42813c2 commit 86dbb62
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cypress/integration/data_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
describe('Static Articles data', () => {
let responseStatus;
let responseBody;

const testScenarioResponse = (title, assertion) => {
it(title, () => {
assertion();
});
};

beforeEach(() => {
cy.request(`/data/scenario-01.json`).then(({ status, body }) => {
responseStatus = status;
responseBody = body;
});
});

testScenarioResponse('should return a 200 status code', () => {
expect(responseStatus).to.eq(200);
});

describe('Response Body', () => {
testScenarioResponse('should be an object', () => {
expect(responseBody).to.be.an('object');
});

testScenarioResponse('should contain a blocks object', () => {
expect(responseBody).to.have.property('blocks');
});
});
});
1 change: 1 addition & 0 deletions src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const assets = require(process.env.RAZZLE_ASSETS_MANIFEST);
const server = express();
server
.disable('x-powered-by')
.use('/data', express.static('data'))
.use(express.static(process.env.RAZZLE_PUBLIC_DIR))
.get('/status', (req, res) => {
res.sendStatus(200);
Expand Down

0 comments on commit 86dbb62

Please sign in to comment.