Signal-iOS/Signal/test/AppDelegateTest.swift
Evan Hahn e060f8faac
Set "New Message" shortcut dynamically, fixing bugs
This fixes two bugs with the "New Message" shortcut:

- It was available even when you weren't registered (e.g., when you just
  installed the app)
- It was not translated, so users always saw "New Message" even if their
  phone wasn't in English
2022-09-29 22:04:56 +00:00

21 lines
680 B
Swift

//
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
import XCTest
@testable import Signal
class AppDelegateTest: XCTestCase {
func testApplicationShortcutItems() throws {
func hasNewMessageShortcut(_ shortcuts: [UIApplicationShortcutItem]) -> Bool {
shortcuts.contains(where: { $0.type.contains("quickCompose") })
}
let unregistered = AppDelegate.applicationShortcutItems(isRegisteredAndReady: false)
XCTAssertFalse(hasNewMessageShortcut(unregistered))
let registered = AppDelegate.applicationShortcutItems(isRegisteredAndReady: true)
XCTAssertTrue(hasNewMessageShortcut(registered))
}
}