mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-11-25 14:57:00 +00:00
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]>
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
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'])
|
|
})
|