diff options
Diffstat (limited to 'tests/test_canonical_displays.py')
| -rw-r--r-- | tests/test_canonical_displays.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_canonical_displays.py b/tests/test_canonical_displays.py new file mode 100644 index 0000000..627e3a0 --- /dev/null +++ b/tests/test_canonical_displays.py @@ -0,0 +1,28 @@ +import json +import subprocess +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +EXTENSION = ROOT / "dot_local/share/gnome-shell/extensions/external-display@dotfiles" + + +class DisplayTests(unittest.TestCase): + def test_metadata(self): + metadata = json.loads((EXTENSION / "metadata.json").read_text()) + self.assertEqual(metadata["uuid"], "external-display@dotfiles") + self.assertIn("50", metadata["shell-version"]) + + def test_connection_changes_and_lifecycle(self): + code = "\n".join( + line + for line in (EXTENSION / "extension.js").read_text().splitlines() + if not line.startswith("import ") + ).replace("export default class", "class") + harness = (ROOT / "tests/fixtures/display-lifecycle.js").read_text() + subprocess.run( + ["node", "--input-type=module"], + input=harness.replace("// EXTENSION", code), + text=True, + check=True, + ) |
