Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = function _static (asset, options = {}) {
let pkg = JSON.parse(read(manifest))
let asset = pkg[key]
if (!asset)
throw ReferenceError(`Could not find asset in static.json (asset fingerprint manifest): ${key}`)
return `${path}/${key}`
return `${path}/${asset}`
}
return `${path}/${isIndex ? '' : key}`
Expand Down
9 changes: 4 additions & 5 deletions test/unit/src/static/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test('Staging env returns non-fingerprinted path if static manifest is not prese
t.equal(asset, '/_static/foo.png', 'Returned non-fingerprinted path')
})

test('Staging env returns non-fingerprinted path if static manifest is present', t => {
test('Staging env returns fingerprinted path if static manifest is present', t => {
t.plan(1)
reset()
manifestExists = true
Expand All @@ -61,14 +61,13 @@ test('Staging env returns non-fingerprinted path if static manifest is present',
t.equal(asset, '/_static/foo-1a2b3d.png', 'Returned fingerprinted path')
})

test('Staging env returns non-fingerprinted path if static manifest is present', t => {
test('Staging env returns non-fingerprinted path if file is not present in static manifest mapping', t => {
t.plan(1)
reset()
manifestExists = true
process.env.NODE_ENV = 'staging'
t.throws(() => {
arcStatic('bar.png')
}, 'Static helper throws error if asset is not found')
let asset = arcStatic('bar.png')
t.equal(asset, '/_static/bar.png', 'Returned non-fingerprinted path')
})

test('Passing stagePath option adds API Gateway /staging or /production to path', t => {
Expand Down