Skip to content

Commit

Permalink
fix lint and test
Browse files Browse the repository at this point in the history
  • Loading branch information
AWare committed Oct 22, 2019
1 parent 1c648a0 commit b1a0800
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion projects/Mallard/src/components/front/image-resource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const ImageResource = ({
image,
style,
setAspectRatio = false,
use,
use, //eslint-disable-line
...props
}: ImageResourceProps) => {
const [width, setWidth] = useState<number | null>(null)
Expand Down
2 changes: 0 additions & 2 deletions projects/Mallard/src/components/front/items/image-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ const imageStyles = StyleSheet.create({

const ImageItem = ({ article, size, ...tappableProps }: PropTypes) => {
const [isOpinionCard, isSportCard] = [useIsOpinionCard(), useIsSportCard()]
const isTablet = false
const trailImage = article.trailImage
if (isOpinionCard && isSmallItem(size)) {
return <RoundImageItem {...{ article, size, ...tappableProps }} />
}
Expand Down
32 changes: 22 additions & 10 deletions projects/Mallard/src/paths/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ describe('paths', () => {
)
})

it('should give correct media root directory', () => {
expect(FSPaths.mediaRoot('daily-edition/2019-10-10')).toEqual(
'path/to/base/directory/issues/daily-edition/2019-10-10/media',
)
})

it('should give correct zip file location based on a local issue id and filename', () => {
expect(
FSPaths.zip('daily-edition/2019-10-10', '2019-10-10'),
Expand All @@ -57,17 +51,35 @@ describe('paths', () => {
)
})

it('should give a media path on the local device', () => {
it('should give a media path on the local device for a full sized image', () => {
expect(
FSPaths.media(
FSPaths.image(
'daily-edition/2019-10-10',
'source',
'path',
'phone',
{
source: 'source',
path: 'path',
},
'full-size',
),
).toEqual(
'path/to/base/directory/issues/daily-edition/2019-10-10/media/phone/source/path',
)
})
it('should give a media path on the local device for a thumbnail image', () => {
expect(
FSPaths.image(
'daily-edition/2019-10-10',
'phone',
{
source: 'source',
path: 'path',
},
'thumb',
),
).toEqual(
'path/to/base/directory/issues/daily-edition/2019-10-10/thumbs/phone/thumb/source/path',
)
})
})
})
2 changes: 0 additions & 2 deletions projects/Mallard/src/paths/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@ export const APIPaths = {
const issuesDir = `${RNFetchBlob.fs.dirs.DocumentDir}/issues`

const issueRoot = (localIssueId: string) => `${issuesDir}/${localIssueId}`
const imageRoot = (localIssueId: string) => `${issueRoot(localIssueId)}/images`
export const MEDIA_CACHE_DIRECTORY_NAME = 'cached'

export const FSPaths = {
issuesDir,
contentPrefixDir: `${issuesDir}/${defaultSettings.contentPrefix}`,
issueRoot,
imageRoot,
image: (
localIssueId: string,
size: ImageSize,
Expand Down

0 comments on commit b1a0800

Please sign in to comment.