Skip to content

Commit

Permalink
fix(typos): bad var name, path match, codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
frickjack committed Dec 5, 2017
1 parent 172c3cb commit 030dbc6
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Certificate/Quiz.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Question extends Component {
</div>
<RadioGroup showErrors={false} field={this.props.content.id}>
{
group => <div>
group => (<div>
{
this.props.content.options.map(
(option, i) =>
Expand All @@ -82,7 +82,7 @@ class Question extends Component {
/>{option}</OptionBullet>),
)
}
</div>
</div>)
}
</RadioGroup>
</QuestionItem>
Expand Down
2 changes: 1 addition & 1 deletion src/DataDictionary/DataDictionary.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('the DataDictionary component', () => {
const ux = mount(
<StaticRouter location={{ pathname: '/dd' }}>
<DataDictionary dictionary={testDict} />
</StaticRouter>
</StaticRouter>,
);
expect(ux.find('table').length).toBe(2);
});
Expand Down
4 changes: 2 additions & 2 deletions src/DataDictionary/DictionaryGraph.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ describe('the DictionaryGraph', () => {
it('boots to a full view', () => {
const { $graph } = buildTest();
expect($graph.length).toBe(1);
expect(!! $graph.find('div[data-toggle="full"]')).toBe(true);
expect(!!$graph.find('div[data-toggle="full"]')).toBe(true);
});

it('toggles between full and compact views', () => {
const { $graph, $dom } = buildTest();
const $toggleButton = $dom.find('a#toggle_button');
expect($toggleButton.length).toBe(1);
$toggleButton.simulate('click');
expect(!! $graph.find('div[data-toggle="abridged"]')).toBe(true);
expect(!!$graph.find('div[data-toggle="abridged"]')).toBe(true);
expect(document.querySelector('#data_model_graph')).toBeDefined();
// jsdom does not yet support svg
// const ellipseList = document.querySelectorAll('ellipse');
Expand Down
2 changes: 1 addition & 1 deletion src/DataModelGraph/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export function nodesBreadthFirst(nodes, edges) {
}

// queue.shift is O(n), so just keep pushing, and move the head
for (let head = 0; head < queue.length; head+=1) {
for (let head = 0; head < queue.length; head += 1) {
const { query, level } = queue[head]; // breadth first
result.bfOrder.push(query);
processedNodes.add(query);
Expand Down
4 changes: 2 additions & 2 deletions src/Login/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const LoginButton = styled.a`
const Login = (props) => {
let next = basename;
const location = props.location; // this is the react-router "location"
const queryParams = querystring.parse(location.search ? location.search.replace(/^\?+/,'') : '');
const queryParams = querystring.parse(location.search ? location.search.replace(/^\?+/, '') : '');
if (queryParams.next) {
next = basename === '/' ? queryParams.next : basename + queryParmas.next;
next = basename === '/' ? queryParams.next : basename + queryParams.next;
}
return (
<div>
Expand Down
11 changes: 6 additions & 5 deletions src/Login/ProtectedContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ let lastTokenRefreshMs = 0;
/**
* Redux listener - just clears auth-cache on logout
*/
export function logoutListener(state={}, action) {
export function logoutListener(state = {}, action) {
switch (action.type) {
case 'RECEIVE_API_LOGOUT':
lastAuthMs = 0;
lastTokenRefreshMs = 0;
break;
default: // noop
}
return state;
Expand All @@ -32,7 +33,7 @@ export function logoutListener(state={}, action) {
*/
export function intersection(aList, bList) {
const key2Count = aList.concat(bList).reduce(
(db,it) => { if (db[it]) { db[it] += 1; } else { db[it] = 1; } return db; },
(db, it) => { if (db[it]) { db[it] += 1; } else { db[it] = 1; } return db; },
{},
);
return Object.entries(key2Count)
Expand Down Expand Up @@ -72,10 +73,10 @@ class ProtectedContent extends React.Component {
// user is authenticated - now check if he has certs
const isMissingCerts = intersection(requiredCerts, user.certificates_uploaded).length !== requiredCerts.length;
// take quiz if this user doesn't have required certificate
if (this.props.location.pathname !== '/quiz' && isMissingCerts) {
if (this.props.match.path !== '/quiz' && isMissingCerts) {
newState.redirectTo = '/quiz';
// do not update lastAuthMs (indicates time of last successful auth)
} else if (this.props.location.pathname === '/quiz' && !isMissingCerts) {
} else if (this.props.match.path === '/quiz' && !isMissingCerts) {
newState.redirectTo = '/';
}
return newState;
Expand Down Expand Up @@ -195,7 +196,7 @@ class ProtectedContent extends React.Component {
*/
componentDidMount() {
getReduxStore().then(
store =>
store =>
Promise.all(
[
store.dispatch({ type: 'CLEAR_COUNTS' }), // clear some counters
Expand Down
1 change: 0 additions & 1 deletion src/reducers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { reducer as formReducer } from 'redux-form';
import { combineReducers } from 'redux';
//import { routerReducer } from 'react-router-redux';
import userProfile from './UserProfile/reducers';
import certificate from './Certificate/reducers';
import submission from './Submission/reducers';
Expand Down

0 comments on commit 030dbc6

Please sign in to comment.