mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-07-05 01:11:32 +02:00
Use better behavior on disconnected radio and allow deeplinking into settings. Closes #66.
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import {
|
||||
parseHashConversation,
|
||||
parseHashSettingsSection,
|
||||
getSettingsHash,
|
||||
getMapFocusHash,
|
||||
resolveChannelFromHashToken,
|
||||
resolveContactFromHashToken,
|
||||
@@ -147,6 +149,34 @@ describe('parseHashConversation', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('settings URL hashes', () => {
|
||||
let originalHash: string;
|
||||
|
||||
beforeEach(() => {
|
||||
originalHash = window.location.hash;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
window.location.hash = originalHash;
|
||||
});
|
||||
|
||||
it('parses a valid settings section hash', () => {
|
||||
window.location.hash = '#settings/database';
|
||||
|
||||
expect(parseHashSettingsSection()).toBe('database');
|
||||
});
|
||||
|
||||
it('returns null for an invalid settings section hash', () => {
|
||||
window.location.hash = '#settings/not-a-section';
|
||||
|
||||
expect(parseHashSettingsSection()).toBeNull();
|
||||
});
|
||||
|
||||
it('builds a stable settings hash', () => {
|
||||
expect(getSettingsHash('local')).toBe('#settings/local');
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolveChannelFromHashToken', () => {
|
||||
const channels: Channel[] = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user