aboutsummaryrefslogtreecommitdiffstats
path: root/tests/entries.bats
blob: 0b508767a139748913310f31c4b83bc18422a0b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bats

@test "Firefox desktop entry and all its actions are extracted" {
  run ../sway-launcher-desktop.sh entries data/desktop-files/0/applications/firefox.desktop
  echo -e "OUTPUT:\n$output"
  [ "$status" -eq 0 ]
  [[ ${lines[0]} =~ data/desktop-files/0/applications/firefox.desktop ]]
  [[ ${lines[0]} =~ ^data/desktop-files/0/applications/firefox.desktop.*Firefox ]]
  [[ ${lines[1]} =~ ^data/desktop-files/0/applications/firefox.desktop.*Firefox.*(New Window).*new-window ]]
  [[ ${lines[2]} =~ ^data/desktop-files/0/applications/firefox.desktop.*Firefox.*(New Private Window).*new-private-window ]]
}

@test "Inkscape desktop entry and all its actions are extracted" {
  run ../sway-launcher-desktop.sh entries data/desktop-files/0/applications/org.inkscape.Inkscape.desktop
  echo -e "OUTPUT:\n$output"
  [ "$status" -eq 0 ]
  [[ ${lines[0]} =~ data/desktop-files/0/applications/org.inkscape.Inkscape.desktop ]]
  [[ ${lines[0]} =~ ^data/desktop-files/0/applications/org.inkscape.Inkscape.desktop.*Inkscape ]]
  [[ ${lines[1]} =~ ^data/desktop-files/0/applications/org.inkscape.Inkscape.desktop.*Inkscape.*(New.*Drawing).* ]]
}

@test "Wildcard expansion works for extraction of desktop files" {
  run ../sway-launcher-desktop.sh entries data/desktop-files/0/applications/*.desktop
  [ "$status" -eq 0 ]
  [[ ${#lines[@]} ==  8 ]]
}

@test "Reoccurring desktop file ids are not parsed twice" {
  run ../sway-launcher-desktop.sh entries data/desktop-files/**/*.desktop
    echo "EXPECTED: foo-bar.desktop ACTUAL: $output"
  [ "$status" -eq 0 ]
  [[ ${#lines[@]} ==  8 ]]
}