Skip to content

Commit

Permalink
Merge 2de4db1 into f9af32b
Browse files Browse the repository at this point in the history
  • Loading branch information
danactive committed Jul 7, 2020
2 parents f9af32b + 2de4db1 commit 84c8d97
Show file tree
Hide file tree
Showing 9 changed files with 4,010 additions and 1,647 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Your personal **history** storyboarded with photo and video albums. Associate ph
* Plot thumbnails on a map
* Includes administration tools for XML generation

[Demonstration site http://history.domaindesign.ca/](http://history.domaindesign.ca/)
[Demonstration site https://history.domaindesign.ca/](https://history.domaindesign.ca/)
## Project Status:
| Service | Status |
|---|---|
Expand Down
2 changes: 1 addition & 1 deletion ui/app/components/Button/tests/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { fireEvent, render } from '@testing-library/react';
import Button from '../index';

const handleRoute = () => {};
const href = 'http://mxstbr.com';
const href = 'https://history.domaindesign.ca';
const children = <h1>Test</h1>;
const renderComponent = (props = {}) => {
const utils = render(
Expand Down
2 changes: 1 addition & 1 deletion ui/app/components/ThumbImg/tests/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('Component - <ThumbImg />', () => {
test('should not adopt a srcset attribute', () => {
const { container } = render(<ThumbImg srcset="test-HD.png 2x" />);
const received = container.querySelector('img').srcset;
const expected = 'null';
const expected = '';
expect(received).toEqual(expected);
});
});
6 changes: 3 additions & 3 deletions ui/app/containers/AlbumViewPage/tests/saga.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Dropbox } from 'dropbox';
import 'whatwg-fetch';
import { fetch } from 'whatwg-fetch';

import { call, put, select } from 'redux-saga/effects';

Expand Down Expand Up @@ -27,7 +27,7 @@ describe('AlbumViewPage Saga', () => {
expect.hasAssertions();
const received = generator.next().value;
const expected = call(
[new Dropbox(), 'filesGetTemporaryLink'],
[new Dropbox({ fetch }), 'filesGetTemporaryLink'],
argsAlbumXmlPath(fixtures),
);
// Unit test cannot reproduce global fetch so delete
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('AlbumViewPage Saga', () => {
expect.hasAssertions();
const received = generator.next().value;
const expected = call(
[new Dropbox(), 'filesGetTemporaryLink'],
[new Dropbox({ fetch }), 'filesGetTemporaryLink'],
argsAlbumXmlPath(fixtures),
);
expect(received).toEqual(expected);
Expand Down
6 changes: 3 additions & 3 deletions ui/app/containers/App/tests/__snapshots__/index.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<App /> should render and match the snapshot 1`] = `
<ForwardRef(App__AppWrapper)>
<App__AppWrapper>
<Helmet
defaultTitle="History"
defer={true}
Expand Down Expand Up @@ -53,6 +53,6 @@ exports[`<App /> should render and match the snapshot 1`] = `
/>
</Switch>
<Footer />
<UNDEFINED />
</ForwardRef(App__AppWrapper)>
<Memo(GlobalStyleComponent) />
</App__AppWrapper>
`;
30 changes: 22 additions & 8 deletions ui/app/utils/localStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ const logError = (...message) => console.error(...message);

export function get(host) {
try {
const json = JSON.parse(localStorage.getItem(hostKey));
return json[host];
if (localStorage) {
const json = JSON.parse(localStorage.getItem(hostKey));

if (json) {
return json[host];
}
}

return null;
} catch (e) {
logError(`Failed to get ${host} to localStorage ${hostKey}`, e);
return null;
Expand All @@ -15,9 +22,14 @@ export function get(host) {

export function update(host, value) {
try {
const json = JSON.parse(localStorage.getItem(hostKey));
json[host] = value;
localStorage.setItem(hostKey, JSON.stringify(json));
if (localStorage) {
const json = JSON.parse(localStorage.getItem(hostKey));
if (json) {
json[host] = value;
localStorage.setItem(hostKey, JSON.stringify(json));
return;
}
}
} catch (e) {
const json = { [host]: value };
localStorage.setItem(hostKey, JSON.stringify(json));
Expand All @@ -27,9 +39,11 @@ export function update(host, value) {

export function remove(host) {
try {
const json = JSON.parse(localStorage.getItem(hostKey));
delete json[host];
localStorage.setItem(hostKey, JSON.stringify(json));
if (localStorage) {
const json = JSON.parse(localStorage.getItem(hostKey));
delete json[host];
localStorage.setItem(hostKey, JSON.stringify(json));
}
} catch (e) {
logError(`Failed to remove ${host} from localStorage ${hostKey}`, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ exports[`<App /> should render and match the snapshot 1`] = `
component={[Function]}
/>
</Switch>
<UNDEFINED />
<Memo(GlobalStyleComponent) />
</div>
`;
Loading

0 comments on commit 84c8d97

Please sign in to comment.