Best JavaScript code snippet using jest
org.openmandriva.plasma.desktop.defaultPanel-layout.js
Source: org.openmandriva.plasma.desktop.defaultPanel-layout.js
...23panel.hiding = "none";24// by default kicker is used, options are kickoff and kickerdash25var launcher = panel.addWidget("org.kde.plasma.kicker")26launcher.currentConfigGroup = ["Shortcuts"]27launcher.writeConfig("global", "Alt+F1")28launcher.currentConfigGroup = ["General"]29launcher.writeConfig("favorites", "preferred://browser,org.kde.kmail.desktop,org.kde.konversation.desktop,kcm_kdeconnect.desktop,org.kde.dolphin.desktop,org.kde.kate.desktop,org.kde.konsole.desktop,systemsettings.desktop")30launcher.writeConfig("limitDepth", false)31launcher.writeConfig("useExtraRunners", true)32launcher.writeConfig("alignResultsToBottom", true)33launcher.writeConfig("appNameFormat", "3")34launcher.writeConfig("showRecentContacts", "true")35launcher.writeConfig("showRecentApps", "true")36launcher.writeConfig("showRecentDocs", "true")37launcher.writeConfig("appNameFormat", "0")38var tasks = panel.addWidget("org.kde.plasma.taskmanager")39tasks.currentConfigGroup = ["General"]40tasks.writeConfig("forceStripes","true")41tasks.writeConfig("middleClickAction", "Close")42tasks.writeConfig("onlyGroupWhenFull","true")43tasks.writeConfig("groupingStrategy","1")44tasks.writeConfig("highlightWindows","false")45tasks.writeConfig("maxStripes","2")46tasks.writeConfig("showOnlyCurrentDesktop","true")47tasks.writeConfig("showOnlyCurrentScreen","false")48tasks.writeConfig("showOnlyMinimized","false")49tasks.writeConfig("showToolTips","true")50tasks.writeConfig("sortingStrategy","2")51var pager = panel.addWidget("org.kde.plasma.pager")52pager.currentConfigGroup = ["General"]53pager.writeConfig("showWindowIcons","true")54pager.writeConfig("displayedText", "Number")55/* Next up is determining whether to add the Input Method Panel56 * widget to the panel or not. This is done based on whether57 * the system locale's language id is a member of the following58 * white list of languages which are known to pull in one of59 * our supported IME backends when chosen during installation60 * of common distributions. */61var langIds = ["as", // Assamese62 "bn", // Bengali63 "bo", // Tibetan64 "brx", // Bodo65 "doi", // Dogri66 "gu", // Gujarati67 "hi", // Hindi68 "ja", // Japanese69 "kn", // Kannada70 "ko", // Korean71 "kok", // Konkani72 "ks", // Kashmiri73 "lep", // Lepcha74 "mai", // Maithili75 "ml", // Malayalam76 "mni", // Manipuri77 "mr", // Marathi78 "ne", // Nepali79 "or", // Odia80 "pa", // Punjabi81 "sa", // Sanskrit82 "sat", // Santali83 "sd", // Sindhi84 "si", // Sinhala85 "ta", // Tamil86 "te", // Telugu87 "th", // Thai88 "ur", // Urdu89 "vi", // Vietnamese90 "zh_CN", // Simplified Chinese91 "zh_TW"] // Traditional Chinese92if (langIds.indexOf(languageId) != -1) {93 panel.addWidget("org.kde.plasma.kimpanel");94}95var systray = panel.addWidget("org.kde.plasma.systemtray")96systray.currentConfigGroup = ["General"]97systray.writeConfig("communicationsShow", "true")98systray.writeConfig("applicationStatusShown","true")99systray.writeConfig("ShowCommunications","true")100systray.writeConfig("systemServicesShown","true")101systray.writeConfig("hardwareControlShown","true")102systray.writeConfig("miscellaneousShown","true")103systray.writeConfig("extraItems", "org.kde.plasma.devicenotifier,org.kde.plasma.notifications,org.kde.plasma.bluetooth,org.kde.plasma.battery,org.kde.plasma.volume,org.kde.plasma.networkmanagement,org.kde.muonnotifier,org.kde.plasma.clipboard")104systray.writeConfig("hiddenItems", "hp-systray,python3.4m")105systray.writeConfig("knownItems", "org.kde.plasma.notifications,org.kde.plasma.bluetooth,org.kde.plasma.clipboard,org.kde.plasma.battery,org.kde.plasma.volume,org.kde.plasma.networkmanagement,org.kde.plasma.mediacontroller,org.kde.muonnotifier,org.kde.plasma.devicenotifier,org.kde.plasma.clipboard")106var clock = panel.addWidget("org.kde.plasma.digitalclock")107clock.currentConfigGroup = ["Appearance"]108clock.writeConfig("showDate","true")109clock.writeConfig("showWeekNumbers","true")110clock.writeConfig("dateFormat", "isoDate")111clock.writeConfig("use24hFormat", "2")112clock.reloadConfig()113panel.addWidget("org.kde.plasma.trash")114sleep(0.5)115panel.reloadConfig()116// if set to true it is not possible to remove panel :)...
org.openmandriva.plasma.desktop.globalMenuPanel-layout.js
Source: org.openmandriva.plasma.desktop.globalMenuPanel-layout.js
...20panel.hiding = "none"21// by default kicker is used, options are kickoff and kickerdash22var launcher = panel.addWidget("org.kde.plasma.kicker")23launcher.currentConfigGroup = ["Shortcuts"]24launcher.writeConfig("global", "Alt+F1")25launcher.currentConfigGroup = ["General"]26launcher.writeConfig("favorites", "preferred://browser,org.kde.kmail.desktop,org.kde.konversation.desktop,kcm_kdeconnect.desktop,org.kde.dolphin.desktop,org.kde.kate.desktop,org.kde.konsole.desktop,systemsettings.desktop")27launcher.writeConfig("limitDepth", false)28launcher.writeConfig("useExtraRunners", true)29launcher.writeConfig("alignResultsToBottom", true)30launcher.writeConfig("appNameFormat", "3")31launcher.writeConfig("showRecentContacts", "true")32launcher.writeConfig("showRecentApps", "true")33launcher.writeConfig("showRecentDocs", "true")34launcher.writeConfig("appNameFormat", "0")35panel.addWidget("org.kde.plasma.appmenu")36panel.addWidget("org.kde.plasma.panelspacer")37/* Next up is determining whether to add the Input Method Panel38 * widget to the panel or not. This is done based on whether39 * the system locale's language id is a member of the following40 * white list of languages which are known to pull in one of41 * our supported IME backends when chosen during installation42 * of common distributions. */43var langIds = ["as", // Assamese44 "bn", // Bengali45 "bo", // Tibetan46 "brx", // Bodo47 "doi", // Dogri48 "gu", // Gujarati49 "hi", // Hindi50 "ja", // Japanese51 "kn", // Kannada52 "ko", // Korean53 "kok", // Konkani54 "ks", // Kashmiri55 "lep", // Lepcha56 "mai", // Maithili57 "ml", // Malayalam58 "mni", // Manipuri59 "mr", // Marathi60 "ne", // Nepali61 "or", // Odia62 "pa", // Punjabi63 "sa", // Sanskrit64 "sat", // Santali65 "sd", // Sindhi66 "si", // Sinhala67 "ta", // Tamil68 "te", // Telugu69 "th", // Thai70 "ur", // Urdu71 "vi", // Vietnamese72 "zh_CN", // Simplified Chinese73 "zh_TW"] // Traditional Chinese74if (langIds.indexOf(languageId) != -1) {75 panel.addWidget("org.kde.plasma.kimpanel");76}77var systray = panel.addWidget("org.kde.plasma.systemtray")78systray.currentConfigGroup = ["General"]79systray.writeConfig("communicationsShow", "true")80systray.writeConfig("applicationStatusShown","true")81systray.writeConfig("ShowCommunications","true")82systray.writeConfig("systemServicesShown","true")83systray.writeConfig("hardwareControlShown","true")84systray.writeConfig("miscellaneousShown","true")85systray.writeConfig("extraItems", "org.kde.plasma.devicenotifier,org.kde.plasma.notifications,org.kde.plasma.bluetooth,org.kde.plasma.battery,org.kde.plasma.volume,org.kde.plasma.networkmanagement,org.kde.muonnotifier,org.kde.plasma.clipboard")86systray.writeConfig("hiddenItems", "hp-systray,python3.4m")87systray.writeConfig("knownItems", "org.kde.plasma.notifications,org.kde.plasma.bluetooth,org.kde.plasma.clipboard,org.kde.plasma.battery,org.kde.plasma.volume,org.kde.plasma.networkmanagement,org.kde.plasma.mediacontroller,org.kde.muonnotifier,org.kde.plasma.devicenotifier,org.kde.plasma.clipboard")88var clock = panel.addWidget("org.kde.plasma.digitalclock")89clock.currentConfigGroup = ["Appearance"]90clock.writeConfig("showDate","false")91clock.writeConfig("showWeekNumbers","false")92clock.writeConfig("dateFormat", "isoDate")93clock.writeConfig("use24hFormat", "2")94clock.reloadConfig()95sleep(0.5)96panel.reloadConfig()97// if set to true it is not possible to remove panel :)...
mosx-panel-light.js
Source: mosx-panel-light.js
...8koompi_panel.location = "top";9koompi_panel.height = 32;10var space1 = koompi_panel.addWidget("org.kde.plasma.panelspacer");11space1.currentConfigGroup = ["General"]12space1.writeConfig("expanding", false);13space1.writeConfig("length", 7);14var menu = koompi_panel.addWidget("org.kde.plasma.umenu");15menu.currentConfigGroup = ["Shortcuts"]16menu.writeConfig("global", "Alt+F1")17var space2 = koompi_panel.addWidget("org.kde.plasma.panelspacer");18space2.currentConfigGroup = ["General"]19space2.writeConfig("expanding", false);20space2.writeConfig("length", 3);21// var all_tasks = koompi_panel.addWidget("org.kde.plasma.icontasks");22// all_tasks.currentConfigGroup = ["General"]23// all_tasks.writeConfig("launchers" ,"file:///usr/share/applications/org.kde.dolphin.desktop,file:///usr/share/applications/firefox.desktop,file:///usr/share/applications/org.kde.konsole.desktop")24var apptitle = koompi_panel.addWidget("org.communia.apptitle");25apptitle.currentConfigGroup = ["General"]26apptitle.writeConfig("noWindowType", "text");27apptitle.writeConfig("noWindowText", "");28apptitle.writeConfig("textType", 1);29apptitle.writeConfig("bold", true);30var space3 = koompi_panel.addWidget("org.kde.plasma.panelspacer");31space3.currentConfigGroup = ["General"]32space3.writeConfig("expanding", false);33space3.writeConfig("length", 5);34koompi_panel.addWidget("org.kde.plasma.appmenu");35var space4 = koompi_panel.addWidget("org.kde.plasma.panelspacer");36// Add system tray37var systray = koompi_panel.addWidget("org.kde.plasma.systemtray")38var systrayContainmentId = systray.readConfig("SystrayContainmentId")39var systrayContainment = desktopById(systrayContainmentId)40systrayContainment.currentConfigGroup = ["General"]41systrayContainment.writeConfig("extraItems","org.kde.plasma.devicenotifier,org.kde.plasma.networkmanagement,org.kde.discovernotifier,org.kde.plasma.diskquota,org.kde.plasma.bluetooth,org.kde.plasma.clipboard,org.kde.plasma.printmanager,org.kde.plasma.battery")42systrayContainment.writeConfig("knownItems", "org.kde.plasma.volume,org.kde.plasma.networkmanagement,org.kde.plasma.bluetooth,org.kde.plasma.battery,org.kde.discovernotifier,org.kde.plasma.clipboard,org.kde.plasma.mediacontroller,org.kde.plasma.devicenotifier,org.kde.plasma.notifications,org.kde.plasma.printmanager,org.kde.plasma.notifications,org.kde.kdeconnect")43systrayContainment.writeConfig("hiddenItems","org.kde.plasma.clipboard,org.kde.plasma.volume,org.kde.plasma.networkmanagement,org.kde.plasma.battery")44koompi_panel.addWidget("org.kde.plasma.bluetooth")45koompi_panel.addWidget("org.kde.plasma.networkmanagement")46koompi_panel.addWidget("org.kde.plasma.volume")47koompi_panel.addWidget("org.kde.plasma.battery")48var space5 = koompi_panel.addWidget("org.kde.plasma.panelspacer");49space5.currentConfigGroup = ["General"]50space5.writeConfig("expanding", false);51space5.writeConfig("length", 5);52var dateviewer = koompi_panel.addWidget("org.kde.plasma.chiliclock");53dateviewer.currentConfigGroup = ["Appearance"];54dateviewer.writeConfig("customDateFormat", "ddd dd/MM/yy");55dateviewer.writeConfig("fixedFont", true);56dateviewer.writeConfig("fontSize", 14);57var space6 = koompi_panel.addWidget("org.kde.plasma.panelspacer");58space6.currentConfigGroup = ["General"]59space6.writeConfig("expanding", false);60space6.writeConfig("length", 10);61var power = koompi_panel.addWidget("org.kde.plasma.lock_logout");62power.currentConfigGroup = ["General"];63power.writeConfig("show_lockScreen", false);64var space7 = koompi_panel.addWidget("org.kde.plasma.panelspacer");65space7.currentConfigGroup = ["General"]66space7.writeConfig("expanding", false);67space7.writeConfig("length", 10);68var show_desktop = koompi_panel.addWidget("org.kde.plasma.win7showdesktop");69show_desktop.currentConfigGroup = ["General"];70show_desktop.writeConfig("size", 5);71var Desktops = desktops(); 72for (i=0;i<Desktops.length;i++) {73 d = Desktops[i];74 d.wallpaperPlugin = "org.kde.image";75 d.currentConfigGroup = Array("Wallpaper",76 "org.kde.image",77 "General");78 d.writeConfig("Image", "file:///usr/share/wallpapers/mosx-light.jpg");...
mosx-panel-dark.js
Source: mosx-panel-dark.js
...8koompi_panel.location = "top";9koompi_panel.height = 32;10var space1 = koompi_panel.addWidget("org.kde.plasma.panelspacer");11space1.currentConfigGroup = ["General"]12space1.writeConfig("expanding", false);13space1.writeConfig("length", 7);14var menu = koompi_panel.addWidget("org.kde.plasma.umenu");15menu.currentConfigGroup = ["Shortcuts"]16menu.writeConfig("global", "Alt+F1")17var space2 = koompi_panel.addWidget("org.kde.plasma.panelspacer");18space2.currentConfigGroup = ["General"]19space2.writeConfig("expanding", false);20space2.writeConfig("length", 3);21// var all_tasks = koompi_panel.addWidget("org.kde.plasma.icontasks");22// all_tasks.currentConfigGroup = ["General"]23// all_tasks.writeConfig("launchers" ,"file:///usr/share/applications/org.kde.dolphin.desktop,file:///usr/share/applications/firefox.desktop,file:///usr/share/applications/org.kde.konsole.desktop")24var apptitle = koompi_panel.addWidget("org.communia.apptitle");25apptitle.currentConfigGroup = ["General"]26apptitle.writeConfig("noWindowType", "text");27apptitle.writeConfig("noWindowText", "");28apptitle.writeConfig("textType", 1);29apptitle.writeConfig("bold", true);30var space3 = koompi_panel.addWidget("org.kde.plasma.panelspacer");31space3.currentConfigGroup = ["General"]32space3.writeConfig("expanding", false);33space3.writeConfig("length", 5);34koompi_panel.addWidget("org.kde.plasma.appmenu");35var space4 = koompi_panel.addWidget("org.kde.plasma.panelspacer");36// Add system tray37var systray = koompi_panel.addWidget("org.kde.plasma.systemtray")38var systrayContainmentId = systray.readConfig("SystrayContainmentId")39var systrayContainment = desktopById(systrayContainmentId)40systrayContainment.currentConfigGroup = ["General"]41systrayContainment.writeConfig("extraItems","org.kde.plasma.devicenotifier,org.kde.plasma.networkmanagement,org.kde.discovernotifier,org.kde.plasma.diskquota,org.kde.plasma.bluetooth,org.kde.plasma.clipboard,org.kde.plasma.printmanager,org.kde.plasma.battery")42systrayContainment.writeConfig("knownItems", "org.kde.plasma.volume,org.kde.plasma.networkmanagement,org.kde.plasma.bluetooth,org.kde.plasma.battery,org.kde.discovernotifier,org.kde.plasma.clipboard,org.kde.plasma.mediacontroller,org.kde.plasma.devicenotifier,org.kde.plasma.notifications,org.kde.plasma.printmanager,org.kde.plasma.notifications,org.kde.kdeconnect")43systrayContainment.writeConfig("hiddenItems","org.kde.plasma.clipboard,org.kde.plasma.volume,org.kde.plasma.networkmanagement,org.kde.plasma.battery")44koompi_panel.addWidget("org.kde.plasma.bluetooth")45koompi_panel.addWidget("org.kde.plasma.networkmanagement")46koompi_panel.addWidget("org.kde.plasma.volume")47koompi_panel.addWidget("org.kde.plasma.battery")48var space5 = koompi_panel.addWidget("org.kde.plasma.panelspacer");49space5.currentConfigGroup = ["General"]50space5.writeConfig("expanding", false);51space5.writeConfig("length", 5);52var dateviewer = koompi_panel.addWidget("org.kde.plasma.chiliclock");53dateviewer.currentConfigGroup = ["Appearance"];54dateviewer.writeConfig("customDateFormat", "ddd dd/MM/yy");55dateviewer.writeConfig("fixedFont", true);56dateviewer.writeConfig("fontSize", 14);57var space6 = koompi_panel.addWidget("org.kde.plasma.panelspacer");58space6.currentConfigGroup = ["General"]59space6.writeConfig("expanding", false);60space6.writeConfig("length", 10);61var power = koompi_panel.addWidget("org.kde.plasma.lock_logout");62power.currentConfigGroup = ["General"];63power.writeConfig("show_lockScreen", false);64var space7 = koompi_panel.addWidget("org.kde.plasma.panelspacer");65space7.currentConfigGroup = ["General"]66space7.writeConfig("expanding", false);67space7.writeConfig("length", 10);68var show_desktop = koompi_panel.addWidget("org.kde.plasma.win7showdesktop");69show_desktop.currentConfigGroup = ["General"];70show_desktop.writeConfig("size", 5);71var Desktops = desktops(); 72for (i=0;i<Desktops.length;i++) {73 d = Desktops[i];74 d.wallpaperPlugin = "org.kde.image";75 d.currentConfigGroup = Array("Wallpaper",76 "org.kde.image",77 "General");78 d.writeConfig("Image", "file:///usr/share/wallpapers/mosx-dark.jpg");...
test-mysqlPoolConnectionsConfigFactory.js
1'use strict';2const Should = require('should');3const Path = require('path');4const MysqlPoolConnectionsConfigFactory = require('../../lib/mysqlPoolConnectionConfigFactory');5const MysqlPoolConnectionConfig = require('../../lib/mysqlPoolConnectionConfig');6describe('MysqlPoolConnectionsConfigFactory', function() {7 describe('createWriteConnectionConfigFromNodeConfig', function() {8 it('Should load from config-1/test.json', function() {9 const nodeConfig = Internals.resetNodeConfig('config-1');10 const writeConfig = MysqlPoolConnectionsConfigFactory.createWriteConnectionConfigFromNodeConfig(nodeConfig);11 Should.exist(writeConfig);12 writeConfig.should.be.an.instanceOf(MysqlPoolConnectionConfig);13 writeConfig.host.should.eql('localhost');14 Should.not.exist(writeConfig.port);15 writeConfig.database.should.eql('optimage');16 writeConfig.user.should.eql('optimagedev');17 writeConfig.password.should.eql('=7QM^!4ynHebT7s7');18 writeConfig.connectionLimit.should.eql(10);19 });20 it('Should load from config-2/test.json', function() {21 const nodeConfig = Internals.resetNodeConfig('config-2');22 const writeConfig = MysqlPoolConnectionsConfigFactory.createWriteConnectionConfigFromNodeConfig(nodeConfig);23 Should.exist(writeConfig);24 writeConfig.should.be.an.instanceOf(MysqlPoolConnectionConfig);25 writeConfig.host.should.eql('somehost');26 writeConfig.port.should.eql(30000);27 writeConfig.database.should.eql('db');28 writeConfig.user.should.eql('user');29 writeConfig.password.should.eql('badpassword');30 writeConfig.connectionLimit.should.eql(100);31 Should.exist(writeConfig.multipleStatements);32 writeConfig.multipleStatements.should.be.true;33 writeConfig.timezone.should.eql('utc');34 });35 });36 describe('createReadConnectionConfigFromNodeConfig', function() {37 it('Should load from config-1/test.json', function() {38 const nodeConfig = Internals.resetNodeConfig('config-1');39 const readConfig = MysqlPoolConnectionsConfigFactory.createReadConnectionConfigFromNodeConfig(nodeConfig);40 Should.exist(readConfig);41 readConfig.should.be.an.instanceOf(MysqlPoolConnectionConfig);42 readConfig.host.should.eql('localhost');43 Should.not.exist(readConfig.port);44 readConfig.database.should.eql('optimage');45 readConfig.user.should.eql('optimagedev');46 readConfig.password.should.eql('=7QM^!4ynHebT7s7');47 readConfig.connectionLimit.should.eql(10);48 });49 it('Should load from config-2/test.json', function() {50 const nodeConfig = Internals.resetNodeConfig('config-2');51 const readConfig = MysqlPoolConnectionsConfigFactory.createReadConnectionConfigFromNodeConfig(nodeConfig);52 Should.not.exist(readConfig);53 });54 });55});56class Internals {57 /**58 * @param {string} configDirName59 */60 static resetNodeConfig(configDirName) {61 process.env.NODE_CONFIG_DIR = Path.resolve(__dirname, '../unit-helper/mysqlPoolConnectionConfigFactory', configDirName);62 return require('config-uncached')(true);63 }...
30-desktop-base-ezgo.js
Source: 30-desktop-base-ezgo.js
1for (var i = 0; i < screenCount; ++i) {2 var desktop = new Activity("folderview")3 desktop.name = i18n("ezgo\u684c\u9762")4 desktop.screen = i5 desktop.writeConfig("savedPositions", "1,3,ezgo æå¸,10,110,æç ezgo.desktop,10,10,firefox.desktop,13,214")6 desktop.wallpaperPlugin = 'image'7 desktop.wallpaperMode = 'SingleImage'8 desktop.writeConfig('zvalue', 0)9 desktop.currentConfigGroup = Array('Wallpaper', 'image')10 desktop.writeConfig('slidepaths', '/usr/share/ezgo/wallpaper/')11 desktop.writeConfig("slideTimer", 360)12 desktop.writeConfig("userswallpapers", "/usr/share/ezgo/wallpaper/ezgo12-wallpapaer-1366x768.png,/usr/share/ezgo/wallpaper/ezgo12-wallpaper-1920x1080.png")13 desktop.writeConfig("wallpaper", "/etc/alternatives/desktop-background")14 desktop.writeConfig("wallpaperposition", 2)15 desktop.writeConfig("immutability", 2)16 rssnow = desktop.addWidget("rssnow")17 rssnow.writeConfig("feeds", "http://ezgo-tw.blogspot.tw/feeds/posts/default");18 rssnow.writeConfig("interval", 5)19 rssnow.writeConfig("switchInterval", 30)20 rssnow.writeConfig("immutability", 1)21 rssnow.geometry = QRectF(screenGeometry(desktop.screen).width - 400,66,300,300)22 trash = desktop.addWidget("trash")23 trash.geometry = QRectF(screenGeometry(desktop.screen).width - 200,450,174,104)24 trash.writeConfig("immutability", 1)25 trash.writeConfig("zvalue", 0)26 var sal = new Activity("sal")27 sal.name = i18n("Netbook\u684c\u9762")28 sal.wallpaperPlugin = 'image'29 sal.wallpaperMode = 'SingleImage'30 sal.writeConfig("EnabledEntries", "plasma-sal-graphics.desktop,plasma-sal-education.desktop,plasma-sal-office.desktop,Tutorial/,ezgo/,Network/,wine-wine/,OpenContent/,Settingsmenu/,AudioVideo/,Game/,Accessibility/,plasma-sal-system.desktop,plasma-sal-development.desktop")31 sal.writeConfig('zvalue', 0)32 sal.currentConfigGroup = Array('Wallpaper', 'image')33 sal.writeConfig('slidepaths', '/usr/share/ezgo/wallpaper/')34 sal.writeConfig("slideTimer", 60)35 sal.writeConfig("userswallpapers", "/usr/share/ezgo/wallpaper/ezgo12-wallpaper-1366x768.png,/usr/share/ezgo/wallpaper/ezgo12-wallpaper-1920x1080.png")36 sal.writeConfig("wallpaper", "/etc/alternatives/desktop-background")37 sal.currentConfigGroup = Array('stripwidget', 'favourite-0')38 sal.writeConfig('url', '/usr/share/applications/firefox.desktop')39 sal.currentConfigGroup = Array('stripwidget', 'favourite-1')40 sal.writeConfig('url', '/usr/share/applications/xbmc.desktop')41 sal.currentConfigGroup = Array('stripwidget', 'favourite-2')42 sal.writeConfig('url', '/usr/share/ezgo/desktop-files/ezinstall.desktop')43 sal.currentConfigGroup = Array('stripwidget', 'favourite-3')44 sal.writeConfig('url', '/usr/share/applications/kde4/konsole.desktop')45 sal.currentConfigGroup = Array('stripwidget', 'favourite-4')46 sal.writeConfig('url', '/usr/share/applications/kde4/kate.desktop')47 sal.reloadConfig()...
org.kde.plasma.desktop-layout.js
Source: org.kde.plasma.desktop-layout.js
...4panel.location = "top"5// App Launcher6var kickoff = panel.addWidget("org.kde.plasma.kickoff")7kickoff.currentConfigGroup = ["Shortcuts"]8kickoff.writeConfig("global", "Alt+F1")9// App Title10if (knownWidgetTypes.indexOf('org.kde.windowtitle') > -1) {11 var wTitle = panel.addWidget("org.kde.windowtitle")12 wTitle.writeConfig("boldFont", true)13 wTitle.writeConfig("filterActivityInfo", "false")14 wTitle.writeConfig("filterByScreen", true)15 wTitle.writeConfig("placeHolder", "Cherry Desktop")16 wTitle.writeConfig("showIcon", false)17}18// App Menu19if (knownWidgetTypes.indexOf('org.kde.windowappmenu') > -1) {20 panel.addWidget("org.kde.windowappmenu")21} else {22 panel.addWidget("org.kde.plasma.appmenu")23}24// Spacer to push tray and the rest to the right side25panel.addWidget("org.kde.plasma.panelspacer")26// Tray27panel.addWidget("org.kde.plasma.systemtray")28// Clock29if (knownWidgetTypes.indexOf('org.kde.plasma.betterinlineclock') > -1) {30 var clock = panel.addWidget("org.kde.plasma.betterinlineclock")31 clock.writeConfig("fixedFont", true)32 clock.writeConfig("fontSize", Math.round(panel.height * 0.45))33 clock.writeConfig("showDate", false)34 clock.writeConfig("showSeparator", false)35} else {36 var clock = panel.addWidget("org.kde.plasma.digitalclock")37 clock.writeConfig("showDate", false)38}39// User Switch40var uswitch = panel.addWidget("org.kde.plasma.userswitcher")41uswitch.writeConfig("showFace", true)42uswitch.writeConfig("showFullName", false)43uswitch.writeConfig("showName", false)44uswitch.writeConfig("showTechnicalInfo", true)45// Create sensible "dock" using plasma panel if latte-dock is not exists46if (!applicationExists("latte-dock")) {47 var dock = new Panel()48 dock.alignment = "center"49 dock.height = 5050 dock.hiding = "windowscover"51 dock.location = "bottom"52 dock.minimumLength = gridUnit53 var tasks = dock.addWidget("org.kde.plasma.icontasks")54 tasks.writeConfig("maxStripes", 1)...
layout.js
Source: layout.js
...4 panel.location = 'bottom'5}6panel.height = screenGeometry(panel.screen).height > 1024 ? 35 : 277launcher = panel.addWidget("simplelauncher")8launcher.writeConfig("icon", "/usr/share/ezgo/icons/start_menu.png")9launcher.writeConfig("format", "Name")10launcher.writeConfig("views", "Applications,Favorites,RecentlyUsed,RunCommand,Leave")11launcher.writeConfig("immutability", 1)12sam = panel.addWidget("org.kde.showActivityManager")13sam.writeConfig("immutability", 2)14firefox = panel.addWidget("icon")15firefox.writeConfig("Url", "file:///usr/share/applications/firefox.desktop")16firefox.writeConfig("immutability", 2)17systemsettings = panel.addWidget("icon")18systemsettings.writeConfig("Url", "file:///usr/share/applications/kde4/systemsettings.desktop")19systemsettings.writeConfig("immutability", 2)20dolphin = panel.addWidget("icon")21dolphin.writeConfig("Url", "file:///usr/share/applications/kde4/dolphin.desktop")22dolphin.writeConfig("immutability", 2)23showdesktop = panel.addWidget("showdesktop")24showdesktop.globalShortcut = "Meta+D"25showdesktop.writeConfig("immutability", 2)26tasks = panel.addWidget("tasks")27tasks.writeConfig("immutability", 2)28//panel.addWidget("pager")29systemtray = panel.addWidget("systemtray")30systemtray.writeConfig("immutability", 2)31dc = panel.addWidget("digital-clock")32dc.writeConfig("immutability", 2)33trash = panel.addWidget("trash")34trash.writeConfig("immutability", 2)...
How to test if a method returns an array of a class in Jest
How do node_modules packages read config files in the project root?
Jest: how to mock console when it is used by a third-party-library?
ERESOLVE unable to resolve dependency tree while installing a pacakge
Testing arguments with toBeCalledWith() in Jest
Is there assertCountEqual equivalent in javascript unittests jest library?
NodeJS: NOT able to set PERCY_TOKEN via package script with start-server-and-test
Jest: How to consume result of jest.genMockFromModule
How To Reset Manual Mocks In Jest
How to move '__mocks__' folder in Jest to /test?
Since Jest tests are runtime tests, they only have access to runtime information. You're trying to use a type, which is compile-time information. TypeScript should already be doing the type aspect of this for you. (More on that in a moment.)
The fact the tests only have access to runtime information has a couple of ramifications:
If it's valid for getAll
to return an empty array (because there aren't any entities to get), the test cannot tell you whether the array would have had Entity
elements in it if it hadn't been empty. All it can tell you is it got an array.
In the non-empty case, you have to check every element of the array to see if it's an Entity
. You've said Entity
is a class, not just a type, so that's possible. I'm not a user of Jest (I should be), but it doesn't seem to have a test specifically for this; it does have toBeTruthy
, though, and we can use every
to tell us if every element is an Entity
:
it('should return an array of Entity class', async () => {
const all = await service.getAll()
expect(all.every(e => e instanceof Entity)).toBeTruthy();
});
Beware, though, that all calls to every
on an empty array return true
, so again, that empty array issue raises its head.
If your Jest tests are written in TypeScript, you can improve on that by ensuring TypeScript tests the compile-time type of getAll
's return value:
it('should return an array of Entity class', async () => {
const all: Entity[] = await service.getAll()
// ^^^^^^^^^^
expect(all.every(e => e instanceof Entity)).toBeTruthy();
});
TypeScript will complain about that assignment at compile time if it's not valid, and Jest will complain at runtime if it sees an array containing a non-Entity
object.
But jonrsharpe has a good point: This test may not be useful vs. testing for specific values that should be there.
Check out the latest blogs from LambdaTest on this topic:
Node js has become one of the most popular frameworks in JavaScript today. Used by millions of developers, to develop thousands of project, node js is being extensively used. The more you develop, the better the testing you require to have a smooth, seamless application. This article shares the best practices for the testing node.in 2019, to deliver a robust web application or website.
Storybook offers a clean-room setting for isolating component testing. No matter how complex a component is, stories make it simple to explore it in all of its permutations. Before we discuss the Storybook testing in any browser, let us try and understand the fundamentals related to the Storybook framework and how it simplifies how we build UI components.
Quality Assurance (QA) is at the point of inflection and it is an exciting time to be in the field of QA as advanced digital technologies are influencing QA practices. As per a press release by Gartner, The encouraging part is that IT and automation will play a major role in transformation as the IT industry will spend close to $3.87 trillion in 2020, up from $3.76 trillion in 2019.
This article is a part of our Content Hub. For more in-depth resources, check out our content hub on WebDriverIO Tutorial and Selenium JavaScript Tutorial.
Having a strategy or plan can be the key to unlocking many successes, this is true to most contexts in life whether that be sport, business, education, and much more. The same is true for any company or organisation that delivers software/application solutions to their end users/customers. If you narrow that down even further from Engineering to Agile and then even to Testing or Quality Engineering, then strategy and planning is key at every level.
LambdaTest’s Jest Testing Tutorial covers step-by-step guides around Jest with code examples to help you be proficient with the Jest framework. The Jest tutorial has chapters to help you learn right from the basics of Jest framework to code-based tutorials around testing react apps with Jest, perform snapshot testing, import ES modules and more.
|<p>it('check_object_of_Car', () => {</p><p>
expect(newCar()).toBeInstanceOf(Car);</p><p>
});</p>|
| :- |
Get 100 minutes of automation test minutes FREE!!