Skip to content

Commit

Permalink
Merge pull request #70 from adhocteam/main
Browse files Browse the repository at this point in the history
Fix deployed UI frontend issues (#39)
  • Loading branch information
rahearn authored Sep 30, 2020
2 parents aa97091 + 7b0a274 commit a44a74d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ parameters:
default: "main"
type: string
sandbox_git_branch: # change to feature branch to test deployment
default: "sj-add-callback-to-manifest"
default: "js-fix-deployed-ui-login"
type: string
jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
},
"scripts": {
"start": "react-scripts start",
"build:local": "react-scripts build",
"build": "react-scripts build && mv build/ ../build/server/client",
"build:local": "INLINE_RUNTIME_CHUNK=false react-scripts build",
"build": "INLINE_RUNTIME_CHUNK=false react-scripts build && mv build/ ../build/server/client",
"eject": "react-scripts eject",
"test": "react-scripts test",
"test:ci": "cross-env JEST_JUNIT_OUTPUT_DIR=reports JEST_JUNIT_OUTPUT_NAME=unit.xml CI=true yarn test --coverage --reporters=default --reporters=jest-junit",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/__tests__/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('App', () => {
render(<App />);
});

it('displays the logout button', async () => {
it('displays the login button', async () => {
expect(await waitFor(() => screen.getByText('HSES Login'))).toBeVisible();
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ app.use(session({
resave: false,
}));

if (process.env.NODE_ENV === 'production') {
app.use(express.static(path.join(__dirname, 'client')));
}

authMiddleware.unless = unless;
// TODO: update unless to replace `oauth1CallbackPath with `join('/api', oauth2CallbackPath)`
// once our oauth callback has been updated
Expand Down Expand Up @@ -86,10 +90,6 @@ app.get(oauth2CallbackPath, async (req, res) => {

app.use('/api', router);

if (process.env.NODE_ENV === 'production') {
app.use(express.static(path.join(__dirname, 'client')));
}

const server = app.listen(process.env.PORT || 8080, () => {
logger.info('listening on 8080');
});
Expand Down
2 changes: 1 addition & 1 deletion src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import request from 'supertest';
import server from './index';

describe('Root', () => {
test('Redirects to login if user is not logged in', async () => {
test('Responds with a 401 (Unauthorized) if user is not logged in', async () => {
const response = await request(server).get('/');
expect(response.status).toBe(401);
});
Expand Down

0 comments on commit a44a74d

Please sign in to comment.