org-shortcuts.test.ts86 lines · main
| 1 | // @ts-nocheck |
| 2 | import { describe, expect, it } from 'vitest' |
| 3 | |
| 4 | import { SHORTCUT_REFERENCE_GROUP_ORDER, SHORTCUT_REFERENCE_GROUPS } from '../referenceGroups' |
| 5 | import { SHORTCUT_DEFINITIONS, SHORTCUT_IDS } from '../registry' |
| 6 | |
| 7 | describe('Org settings nav shortcuts', () => { |
| 8 | const navIds = [ |
| 9 | SHORTCUT_IDS.NAV_ORG_SETTINGS_GENERAL, |
| 10 | SHORTCUT_IDS.NAV_ORG_SETTINGS_SECURITY, |
| 11 | SHORTCUT_IDS.NAV_ORG_SETTINGS_SSO, |
| 12 | SHORTCUT_IDS.NAV_ORG_SETTINGS_APPS, |
| 13 | SHORTCUT_IDS.NAV_ORG_SETTINGS_PRIVATE_APPS, |
| 14 | SHORTCUT_IDS.NAV_ORG_SETTINGS_WEBHOOKS, |
| 15 | SHORTCUT_IDS.NAV_ORG_SETTINGS_AUDIT, |
| 16 | SHORTCUT_IDS.NAV_ORG_SETTINGS_AUDIT_LOG_DRAINS, |
| 17 | SHORTCUT_IDS.NAV_ORG_SETTINGS_DOCUMENTS, |
| 18 | ] |
| 19 | |
| 20 | it.each(navIds)('%s is registered with NAVIGATION_ORG_SETTINGS group', (id) => { |
| 21 | expect(SHORTCUT_DEFINITIONS[id].referenceGroup).toBe( |
| 22 | SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ORG_SETTINGS |
| 23 | ) |
| 24 | }) |
| 25 | |
| 26 | it.each(navIds)('%s sequence starts with S', (id) => { |
| 27 | const sequence = SHORTCUT_DEFINITIONS[id].sequence |
| 28 | expect(Array.isArray(sequence) ? sequence[0] : sequence).toBe('S') |
| 29 | }) |
| 30 | }) |
| 31 | |
| 32 | describe('NAV_ORG_SETTINGS remap', () => { |
| 33 | it('uses G , (matching project settings chord)', () => { |
| 34 | const def = SHORTCUT_DEFINITIONS[SHORTCUT_IDS.NAV_ORG_SETTINGS] |
| 35 | expect(def.sequence).toEqual(['G', ',']) |
| 36 | }) |
| 37 | }) |
| 38 | |
| 39 | describe('Org action shortcuts', () => { |
| 40 | it('ORG_OAUTH_APPS_PUBLISH is registered', () => { |
| 41 | expect(SHORTCUT_DEFINITIONS[SHORTCUT_IDS.ORG_OAUTH_APPS_PUBLISH]).toBeDefined() |
| 42 | expect(SHORTCUT_DEFINITIONS[SHORTCUT_IDS.ORG_OAUTH_APPS_PUBLISH].sequence).toEqual(['Shift+N']) |
| 43 | }) |
| 44 | |
| 45 | it('ORG_OAUTH_APPS_SUBMIT uses Mod+Enter and is hidden from settings', () => { |
| 46 | const def = SHORTCUT_DEFINITIONS[SHORTCUT_IDS.ORG_OAUTH_APPS_SUBMIT] |
| 47 | expect(def.sequence).toEqual(['Mod+Enter']) |
| 48 | expect(def.showInSettings).toBe(false) |
| 49 | }) |
| 50 | |
| 51 | it('ORG_TEAM_INVITE is registered', () => { |
| 52 | expect(SHORTCUT_DEFINITIONS[SHORTCUT_IDS.ORG_TEAM_INVITE].sequence).toEqual(['Shift+N']) |
| 53 | }) |
| 54 | |
| 55 | it('ORG_TEAM_INVITE_SUBMIT uses Mod+Enter and is hidden from settings', () => { |
| 56 | const def = SHORTCUT_DEFINITIONS[SHORTCUT_IDS.ORG_TEAM_INVITE_SUBMIT] |
| 57 | expect(def.sequence).toEqual(['Mod+Enter']) |
| 58 | expect(def.showInSettings).toBe(false) |
| 59 | }) |
| 60 | |
| 61 | it('ORG_INTEGRATIONS_ADD_CONNECTION is registered', () => { |
| 62 | expect(SHORTCUT_DEFINITIONS[SHORTCUT_IDS.ORG_INTEGRATIONS_ADD_CONNECTION].sequence).toEqual([ |
| 63 | 'Shift+N', |
| 64 | ]) |
| 65 | }) |
| 66 | |
| 67 | it('ORG_PROJECTS_NEW is registered', () => { |
| 68 | expect(SHORTCUT_DEFINITIONS[SHORTCUT_IDS.ORG_PROJECTS_NEW].sequence).toEqual(['Shift+N']) |
| 69 | }) |
| 70 | |
| 71 | it('ORG_PROJECTS_SEARCH is registered', () => { |
| 72 | expect(SHORTCUT_DEFINITIONS[SHORTCUT_IDS.ORG_PROJECTS_SEARCH].sequence).toEqual(['Shift+F']) |
| 73 | }) |
| 74 | }) |
| 75 | |
| 76 | describe('Reference group ordering', () => { |
| 77 | it('NAVIGATION_ORG_SETTINGS appears after NAVIGATION_GLOBAL', () => { |
| 78 | const globalIdx = SHORTCUT_REFERENCE_GROUP_ORDER.indexOf( |
| 79 | SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL |
| 80 | ) |
| 81 | const orgSettingsIdx = SHORTCUT_REFERENCE_GROUP_ORDER.indexOf( |
| 82 | SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ORG_SETTINGS |
| 83 | ) |
| 84 | expect(orgSettingsIdx).toBeGreaterThan(globalIdx) |
| 85 | }) |
| 86 | }) |