Skip to content

Commit 43824d5

Browse files
committed
fix: image variable in camelcase
1 parent d7b77c0 commit 43824d5

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/images.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const getImage = (
2121
}
2222

2323
if (returns === 'json') {
24-
requestQuery['headers'] = {
24+
requestQuery.headers = {
2525
Accept: 'application/json'
2626
}
2727
}
@@ -30,15 +30,15 @@ const getImage = (
3030
if (['default', 'thumbnail', 'mobile'].includes(size)) {
3131
requestQuery['url'] += `/image/${size}`
3232
} else {
33-
throw `Image size doesn't exists`
33+
throw new Error(`Image size doesn't exists`)
3434
}
3535
}
3636

3737
if (backgroundSize !== undefined) {
3838
if (['default', 'thumbnail', 'mobile', 'tablet'].includes(backgroundSize)) {
3939
requestQuery['url'] += `/background/${backgroundSize}`
4040
} else {
41-
throw `Image background size doesn't exists`
41+
throw new Error(`Image background size doesn't exists`)
4242
}
4343
}
4444

@@ -54,21 +54,21 @@ const getImage = (
5454
if (choiceImageSizes.includes(choiceSize)) {
5555
requestQuery['url'] += `/choice/${choiceSize}`
5656
} else {
57-
throw `Image choice size doesn't exists`
57+
throw new Error(`Image choice size doesn't exists`)
5858
}
5959
}
6060

6161
return http.request(requestQuery)
6262
}
6363

64-
const addImage = (http, { image, media_type, file_name }) => {
64+
const addImage = (http, { image, mediaType, fileName }) => {
6565
return http.request({
6666
method: 'post',
6767
url: `/images`,
6868
data: {
6969
image,
70-
file_name,
71-
media_type
70+
file_name: fileName,
71+
media_type: mediaType
7272
}
7373
})
7474
}

tests/unit/images.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ test('get images by ID', () => {
2626
test('adding an image pass the required values', () => {
2727
imagesRequest.add({
2828
image: 'bGRqZmxzZGpmbHNoZmtoc2RrZmpoc2tqZA==',
29-
media_type: 'image/gif',
30-
file_name: 'newimage.gif'
29+
mediaType: 'image/gif',
30+
fileName: 'newimage.gif'
3131
})
3232

3333
expect(fetch.mock.calls[0][0]).toBe(`${API_BASE_URL}/images`)

0 commit comments

Comments
 (0)