Skip to content

Commit

Permalink
Merge 12adf83 into 04d66a2
Browse files Browse the repository at this point in the history
  • Loading branch information
cdtinney committed Feb 27, 2019
2 parents 04d66a2 + 12adf83 commit ec153f9
Show file tree
Hide file tree
Showing 44 changed files with 4,548 additions and 287 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pids
lib-cov

# Coverage directory used by tools like istanbul
coverage
**/coverage

# nyc test coverage
.nyc_output
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ install:
- "npm run client:build"

script:
- "npm run test"
- "npm run client:coveralls"

deploy:
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- [Running](#running)
- [Stopping](#stopping)
- [Testing](#testing)
- [Server](#server)
- [Client](#client)
- [Coveralls](#coveralls)
- [Building](#building)
Expand Down Expand Up @@ -136,6 +137,20 @@ To run all tests with coverage:
$ npm run test
```

#### Server

To run server tests in watch mode:

```
$ npm run server:test
```

To run server tests with coverage:

```
$ npm run server:test:coverage
```

#### Client

To run client tests in watch mode:
Expand Down
6 changes: 3 additions & 3 deletions client/src/actions/__tests__/user.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('user actions', () => {
describe('async actions', () => {
describe('fetchAuthUser', () => {
it('creates FETCH_AUTH_USER_SUCCESS when fetching user auth succeeds with a user', () => {
mockAxios.onGet('/api/auth').reply(200, {
mockAxios.onGet('/api/auth/user').reply(200, {
user: 'foo',
});

Expand All @@ -34,7 +34,7 @@ describe('user actions', () => {
});

it('creates FETCH_AUTH_USER_SUCCESS with a null profile when fetching user auth succeeds without a user', () => {
mockAxios.onGet('/api/auth').reply(200, {
mockAxios.onGet('/api/auth/user').reply(200, {
user: undefined,
});

Expand All @@ -55,7 +55,7 @@ describe('user actions', () => {
});

it('creates FETCH_AUTH_USER_FAILURE when fetching user auth fails', () => {
mockAxios.onGet('/api/auth').reply(400, 'foo');
mockAxios.onGet('/api/auth/user').reply(400, 'foo');

const expectedActions = [{
type: userActions.FETCH_AUTH_USER_REQ,
Expand Down
2 changes: 1 addition & 1 deletion client/src/actions/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function fetchAuthUser() {
return function fetchAuthUserThunk(dispatch) {
dispatch(fetchAuthUserReq());

return axios.get('/api/auth')
return axios.get('/api/auth/user')
.then(response =>
// The request can still be successful with no user returned.
// In this case, default to `null` (instead of `undefined`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function TopAppBar(props) {
TopAppBar.propTypes = {
title: PropTypes.string.isRequired,
user: PropTypes.shape({
name: PropTypes.string.isRequired,
imageUrl: PropTypes.string.isRequired,
name: PropTypes.string,
imageUrl: PropTypes.string,
}),
classes: PropTypes.object.isRequired,
};
Expand Down
10 changes: 6 additions & 4 deletions client/src/pages/VisualizationPage/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ export class VisualizationPageView extends Component {
},
} = this.props;

const songPlaying = songArtistName !== undefined
&& songTitle !== undefined;
const songPlaying = songArtistName !== null
&& songTitle !== null;

return (
<div className={classes.root}>
Expand All @@ -122,8 +122,10 @@ export class VisualizationPageView extends Component {
<ColorOverlay />
<TopAppBar
title="spune"
userName={userName}
userImageUrl={userImageUrl}
user={userName && userImageUrl ? {
name: userName,
imageUrl: userImageUrl,
} : undefined}
/>
{ songPlaying &&
<div className={classes.content}>
Expand Down
14 changes: 14 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
coverageDirectory: 'server/coverage',
collectCoverageFrom: [
'server/**/*.{js}',
'!server/server.js',
'!server/coverage/**',
],
// By default, Jest runs in a JSDOM environment.
// This has issues: https://mongoosejs.com/docs/jest.html
testEnvironment: 'node',
testPathIgnorePatterns: [
'client',
],
};
Loading

0 comments on commit ec153f9

Please sign in to comment.