diff options
Diffstat (limited to 'packages/meshbay-hub/tests/test_transfers.py')
| -rw-r--r-- | packages/meshbay-hub/tests/test_transfers.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/meshbay-hub/tests/test_transfers.py b/packages/meshbay-hub/tests/test_transfers.py index 1d0c0f0..c7a9dc5 100644 --- a/packages/meshbay-hub/tests/test_transfers.py +++ b/packages/meshbay-hub/tests/test_transfers.py @@ -918,3 +918,23 @@ def test_the_reason_is_translated_everywhere(): `transfers.not_pausable` in a tooltip rather than a sentence.""" for path in sorted((STATIC / "locales").glob("*.js")): assert "'transfers.not_pausable'" in path.read_text(encoding="utf-8"), path.name + + +def test_open_is_offered_only_when_the_target_says_it_can_be(tmp_path): + """A row whose file cannot be opened (a type that could run in the hub's + origin, an archive, a stream the page cannot read back) has no Open button, + rather than one that does nothing.""" + result = _run(""" +const store = new TransferStore(); +const done = (openable) => store.start({ + kind: 'download', name: 'f', total: 1, + prepare: async () => (openable === undefined ? {} : { openable }), + open: () => {}, + run: async ({ onProgress }) => { onProgress(1, 1); }, +}); +done(false); done(true); done(undefined); +await new Promise(r => setTimeout(r, 30)); +say(...store.list().map(it => [it.status, it.canOpen])); +""", tmp_path) + assert sorted(map(tuple, result)) == sorted([ + ("done", False), ("done", True), ("done", True)]) |