[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:
@@ -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,
|
||||
};
|
||||
|
Reference in New Issue
Block a user