Skip to content

Commit

Permalink
fixup! Make sure to only return tus files
Browse files Browse the repository at this point in the history
  • Loading branch information
Murderlon committed Oct 6, 2023
1 parent 9757d01 commit 7f1315b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions packages/file-store/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {strict as assert} from 'node:assert'
import fs from 'node:fs'
import fsProm from 'node:fs/promises'
import path from 'node:path'
import os from 'node:os'

import sinon from 'sinon'

Expand Down Expand Up @@ -97,21 +96,17 @@ describe('FileStore', function () {

describe('FileConfigstore', () => {
it('should ignore random files in directory when calling list()', async function () {
const store = new FileConfigstore(os.tmpdir())
const store = new FileConfigstore(storePath)
const files = ['tus', 'tus.json', 'tu', 'tuss.json', 'random']
for (const file of files) {
await fsProm.writeFile(path.resolve(os.tmpdir(), file), '')
await fsProm.writeFile(path.resolve(storePath, file), '')
}
const list = await store.list()

// list returns the amount of uploads.
// One upload consists of the file and the JSON info file.
// But from the list perspective that is only one upload.
assert.strictEqual(list.length, 1)

for (const file of files) {
await fsProm.rm(path.resolve(os.tmpdir(), file))
}
})
})

Expand Down

0 comments on commit 7f1315b

Please sign in to comment.