mirror of
https://git.um-react.app/um/um-react.git
synced 2026-11-27 23:56:59 +00:00
- Updated import paths for Kugou and Kuwo instructions to reflect new directory structure. - Introduced new key management functionalities for Kugou, including key import and selection logic. - Added comprehensive instructions for both Kugou and Kuwo key handling across various platforms. - Implemented Redux selectors for managing staging and production keys for Kugou and Kuwo. - Enhanced documentation and tests for new features and key management processes.
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { parseQtfmDeviceInfoFromText, parseQtfmDeviceSecretFromText } from '../importKeys';
|
|
import { sanitizeQtfmAndroidKey } from '../types';
|
|
|
|
describe('qtfm import / sanitize', () => {
|
|
test('parseQtfmDeviceSecretFromText extracts DEVICE_SECRET line', () => {
|
|
const text = 'foo\nDEVICE_SECRET: aBcD1234\nbar';
|
|
expect(parseQtfmDeviceSecretFromText(text)).toBe('aBcD1234');
|
|
expect(parseQtfmDeviceSecretFromText('no secret here')).toBeNull();
|
|
});
|
|
|
|
test('parseQtfmDeviceInfoFromText requires all fields', () => {
|
|
const full = ['PRODUCT: p', 'DEVICE: d', 'MANUFACTURER: m', 'BRAND: b', 'BOARD: board', 'MODEL: model'].join('\n');
|
|
expect(parseQtfmDeviceInfoFromText(full)).toEqual({
|
|
product: 'p',
|
|
device: 'd',
|
|
manufacturer: 'm',
|
|
brand: 'b',
|
|
board: 'board',
|
|
model: 'model',
|
|
});
|
|
expect(parseQtfmDeviceInfoFromText('PRODUCT: p\nDEVICE: d')).toBeNull();
|
|
});
|
|
|
|
test('sanitizeQtfmAndroidKey strips non-hex', () => {
|
|
expect(sanitizeQtfmAndroidKey('de-ad_be ef!!')).toBe('deadbeef');
|
|
});
|
|
});
|