Update tests to reflect new changes with null size for pre-existing files
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
This commit is contained in:
parent
9790f298f3
commit
5841dbdaab
2 changed files with 10 additions and 10 deletions
|
@ -740,7 +740,7 @@ t.describe('Media (API)', () => {
|
||||||
assert.ok(data.length)
|
assert.ok(data.length)
|
||||||
let found = false
|
let found = false
|
||||||
for (let file of data) {
|
for (let file of data) {
|
||||||
if (file.filename === '.gitkeep' && file.size === 0) {
|
if (file.filename === '.gitkeep') {
|
||||||
found = true
|
found = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -767,9 +767,9 @@ t.describe('Media (API)', () => {
|
||||||
t.test('should otherwise return list of files for a public site', async () => {
|
t.test('should otherwise return list of files for a public site', async () => {
|
||||||
let files = await client.get('/media/existing')
|
let files = await client.get('/media/existing')
|
||||||
assert.strictEqual(files[0].filename, '20220105_101610_test1.jpg')
|
assert.strictEqual(files[0].filename, '20220105_101610_test1.jpg')
|
||||||
assert.strictEqual(files[0].size, 15079)
|
assert.strictEqual(files[0].size, null)
|
||||||
assert.strictEqual(files[1].filename, '20220105_101610_test2.png')
|
assert.strictEqual(files[1].filename, '20220105_101610_test2.png')
|
||||||
assert.strictEqual(files[1].size, 31705)
|
assert.strictEqual(files[1].size, null)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -36,11 +36,11 @@ t.describe('#filesCacheGet', function() {
|
||||||
assert.strictEqual(routes.filesCacheGet('nonexisting').length, 0)
|
assert.strictEqual(routes.filesCacheGet('nonexisting').length, 0)
|
||||||
|
|
||||||
assert.strictEqual(routes.filesCacheGet('development')[0].filename, '.gitkeep')
|
assert.strictEqual(routes.filesCacheGet('development')[0].filename, '.gitkeep')
|
||||||
assert.strictEqual(routes.filesCacheGet('development')[0].size, 0)
|
assert.strictEqual(routes.filesCacheGet('development')[0].size, null)
|
||||||
assert.strictEqual(routes.filesCacheGet('existing')[0].filename, '20220105_101610_test1.jpg')
|
assert.strictEqual(routes.filesCacheGet('existing')[0].filename, '20220105_101610_test1.jpg')
|
||||||
assert.strictEqual(routes.filesCacheGet('existing')[0].size, 15079)
|
assert.strictEqual(routes.filesCacheGet('existing')[0].size, null)
|
||||||
assert.strictEqual(routes.filesCacheGet('existing')[1].filename, '20220105_101610_test2.png')
|
assert.strictEqual(routes.filesCacheGet('existing')[1].filename, '20220105_101610_test2.png')
|
||||||
assert.strictEqual(routes.filesCacheGet('existing')[1].size, 31705)
|
assert.strictEqual(routes.filesCacheGet('existing')[1].size, null)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.test('should always sort result', async function() {
|
t.test('should always sort result', async function() {
|
||||||
|
@ -51,9 +51,9 @@ t.describe('#filesCacheGet', function() {
|
||||||
let files = routes.filesCacheGet('existing')
|
let files = routes.filesCacheGet('existing')
|
||||||
|
|
||||||
assert.strictEqual(files[0].filename, '20220105_101610_test1.jpg')
|
assert.strictEqual(files[0].filename, '20220105_101610_test1.jpg')
|
||||||
assert.strictEqual(files[0].size, 15079)
|
assert.strictEqual(files[0].size, null)
|
||||||
assert.strictEqual(files[1].filename, '20220105_101610_test2.png')
|
assert.strictEqual(files[1].filename, '20220105_101610_test2.png')
|
||||||
assert.strictEqual(files[1].size, 31705)
|
assert.strictEqual(files[1].size, null)
|
||||||
|
|
||||||
routes.siteCache.get('existing').push({ filename: '0000.png', size: 0 })
|
routes.siteCache.get('existing').push({ filename: '0000.png', size: 0 })
|
||||||
|
|
||||||
|
@ -61,9 +61,9 @@ t.describe('#filesCacheGet', function() {
|
||||||
assert.strictEqual(files[0].filename, '0000.png')
|
assert.strictEqual(files[0].filename, '0000.png')
|
||||||
assert.strictEqual(files[0].size, 0)
|
assert.strictEqual(files[0].size, 0)
|
||||||
assert.strictEqual(files[1].filename, '20220105_101610_test1.jpg')
|
assert.strictEqual(files[1].filename, '20220105_101610_test1.jpg')
|
||||||
assert.strictEqual(files[1].size, 15079)
|
assert.strictEqual(files[1].size, null)
|
||||||
assert.strictEqual(files[2].filename, '20220105_101610_test2.png')
|
assert.strictEqual(files[2].filename, '20220105_101610_test2.png')
|
||||||
assert.strictEqual(files[2].size, 31705)
|
assert.strictEqual(files[2].size, null)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue