diff --git a/src/lib/__tests__/util-test.js b/src/lib/__tests__/util-test.js index 3a5fe7f28..43a534ba7 100644 --- a/src/lib/__tests__/util-test.js +++ b/src/lib/__tests__/util-test.js @@ -511,8 +511,12 @@ describe('lib/util', () => { }); describe('requires360Viewer()', () => { - it('should return true for file name with 360 before extension', () => { - expect(util.requires360Viewer({ name: '360.foo' })).to.be.true; + it('should return true for file name with .360 before extension', () => { + expect(util.requires360Viewer({ name: 'name.360.foo' })).to.be.true; + }); + + it('should return false for file name ending with 360 (e.g. IMG_0360.jpg)', () => { + expect(util.requires360Viewer({ name: 'IMG_0360.foo' })).to.be.false; }); it('should return false for file name with no 360 before extension', () => { @@ -557,14 +561,4 @@ describe('lib/util', () => { expect(element.style.height).to.equal(`${height}px`); }); }); - - describe('requires360Viewer()', () => { - it('should return true for file name with 360 before extension', () => { - expect(util.requires360Viewer({ name: '360.foo' })).to.be.true; - }); - - it('should return false for file name with no 360 before extension', () => { - expect(util.requires360Viewer({ name: 'foo' })).to.be.false; - }); - }); }); diff --git a/src/lib/util.js b/src/lib/util.js index d04e2ee98..74a37824c 100644 --- a/src/lib/util.js +++ b/src/lib/util.js @@ -616,7 +616,7 @@ export function requires360Viewer(file) { // For now, we'll only support this preview if the filename has a secondary // extension of '360' (e.g. file.360.mp4) const basename = file.name.slice(0, file.name.lastIndexOf('.')); - return basename.endsWith('360'); + return basename.endsWith('.360'); } /**