mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-11-27 07:37:00 +00:00
Show parsed file details and list Quark and UC as supported (#299)
The home page now shows the filename, size, and disk name after a successful parse, and the supported-disk copy includes Quark and UC. Bump the app version to 0.4.10. Co-authored-by: Cursor Agent <[email protected]>
This commit is contained in:
1 parent
24c22fad7f
commit
a7d41b0107
7 files changed
+137
-10
No files matched your search
@@ -0,0 +1,33 @@
|
||||
const { test } = require('node:test')
|
||||
const assert = require('node:assert/strict')
|
||||
const { buildParseFileMeta, formatByteSize, panDisplayName } = require('./parseResultMeta.js')
|
||||
|
||||
test('formats binary size like 169.1 M', () => {
|
||||
assert.equal(formatByteSize(0), '0 B')
|
||||
assert.equal(formatByteSize(169.1 * 1024 * 1024), '169.1 M')
|
||||
assert.equal(formatByteSize(10 * 1024 * 1024), '10.0 M')
|
||||
})
|
||||
|
||||
test('builds filename, size and pan tag', () => {
|
||||
assert.deepEqual(buildParseFileMeta({
|
||||
fileName: '末世冰潮.apk',
|
||||
sizeStr: '169.1 M',
|
||||
panType: 'lz',
|
||||
panList: [{ type: 'lz', name: '蓝奏云' }]
|
||||
}), ['末世冰潮.apk', '169.1 M', '蓝奏云'])
|
||||
})
|
||||
|
||||
test('falls back to quark and uc names', () => {
|
||||
assert.equal(panDisplayName('qk', []), '夸克网盘')
|
||||
assert.equal(panDisplayName('UC', []), 'UC网盘')
|
||||
assert.deepEqual(buildParseFileMeta({
|
||||
fileName: 'bilitools_1.4.7_amd64.AppImage',
|
||||
size: 92899832,
|
||||
panType: 'qk'
|
||||
})[2], '夸克网盘')
|
||||
})
|
||||
|
||||
test('omits missing fields', () => {
|
||||
assert.deepEqual(buildParseFileMeta({}), [])
|
||||
assert.deepEqual(buildParseFileMeta({ fileName: 'a.txt' }), ['a.txt'])
|
||||
})
|
||||
Reference in new issue
Block a user