mirror of
https://github.com/standardnotes/app
synced 2026-07-14 00:03:20 -04:00
* wip: command palette * use code instead of key * show recent items above commands * refactor * fix command * add placeholder * Tab/Shift-Tab to switch tabs * Fix test * Add menu item to general account menu * if shortcut_id is available, use that as the id * make toggle fn more stable * small naming changes * fix name * Close open modals and popovers when opening command palette * use stable ids + make sure selectedNotesCount only changes when the count actually changes * display all commands, even ones in recents list
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { Environment, namespacedKey, Platform, RawStorageKey, SNLog } from '@standardnotes/snjs'
|
|
import { WebApplication } from '@/Application/WebApplication'
|
|
import { WebOrDesktopDevice } from './Device/WebOrDesktopDevice'
|
|
|
|
jest.mock('@standardnotes/sncrypto-web', () => {
|
|
return {
|
|
SNWebCrypto: class {
|
|
initialize() {
|
|
return Promise.resolve()
|
|
}
|
|
generateUUID() {
|
|
return 'mock-uuid'
|
|
}
|
|
},
|
|
}
|
|
})
|
|
|
|
describe('web application', () => {
|
|
let application: WebApplication
|
|
|
|
// eslint-disable-next-line no-console
|
|
SNLog.onLog = console.log
|
|
SNLog.onError = console.error
|
|
|
|
beforeEach(async () => {
|
|
const identifier = '123'
|
|
|
|
window.matchMedia = jest.fn().mockReturnValue({ matches: false, addListener: jest.fn() })
|
|
|
|
const device = {
|
|
environment: Environment.Desktop,
|
|
appVersion: '1.2.3',
|
|
setApplication: jest.fn(),
|
|
openDatabase: jest.fn().mockReturnValue(Promise.resolve()),
|
|
getRawStorageValue: jest.fn().mockImplementation(async (key) => {
|
|
if (key === namespacedKey(identifier, RawStorageKey.SnjsVersion)) {
|
|
return '10.0.0'
|
|
}
|
|
return undefined
|
|
}),
|
|
setRawStorageValue: jest.fn(),
|
|
} as unknown as jest.Mocked<WebOrDesktopDevice>
|
|
|
|
application = new WebApplication(device, Platform.MacWeb, identifier, 'https://sync', 'https://socket')
|
|
|
|
await application.prepareForLaunch({ receiveChallenge: jest.fn() })
|
|
})
|
|
|
|
it('should create application', () => {
|
|
expect(application).toBeTruthy()
|
|
})
|
|
})
|