[MM-40316] Unit tests for main/menus (#1877)

* Unit tests for main/menus/app

* Also this

* Unit tests for main/menus/tray
This commit is contained in:
Devin Binnie
2021-11-25 10:41:12 -05:00
committed by GitHub
parent a4a275bd73
commit b20e139971
6 changed files with 266 additions and 22 deletions

View File

@@ -8,10 +8,10 @@ import {CombinedConfig} from 'types/config';
import * as WindowManager from '../windows/windowManager';
function createTemplate(config: CombinedConfig) {
export function createTemplate(config: CombinedConfig) {
const teams = config.teams;
const template = [
...teams.slice(0, 9).sort((teamA, teamB) => teamA.order - teamB.order).map((team) => {
...teams.sort((teamA, teamB) => teamA.order - teamB.order).slice(0, 9).map((team) => {
return {
label: team.name,
click: () => {
@@ -34,11 +34,7 @@ function createTemplate(config: CombinedConfig) {
return template;
}
function createMenu(config: CombinedConfig) {
export function createMenu(config: CombinedConfig) {
// TODO: Electron is enforcing certain variables that it doesn't need
return Menu.buildFromTemplate(createTemplate(config) as Array<MenuItemConstructorOptions | MenuItem>);
}
export default {
createMenu,
};