Skip to content

Commit

Permalink
Update js tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sz3 committed Feb 21, 2020
1 parent cbdc9c0 commit 3348cf3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions js_tests/test_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ QUnit.config.reorder = false;
QUnit.testStart(function(details) {
FileBrowser.get('open-archive').clear();
FileBrowser.get('open-archive').showFiles([
{'path': ''},
{'path': 's3:bucket/'},
{'path': 's3:bucket/dir/'},
{'path': 's3:bucket/dir/foo'},
{'path': 's3:bucket/file.txt'},
{'path': 'local:local.mfn'},
{'path': 'local:local2.mfn'},
{'path': 'local:mydir/'},
{'path': 'local:mydir/home/'},
{'path': 'local:mydir/home/1.txt'}
Expand Down
21 changes: 18 additions & 3 deletions js_tests/test_filebrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ QUnit.test( "initial load manifest list", function( assert ) {
var files = getFiles('open-archive');

assert.deepEqual( folders, ['s3:bucket/', 'local:mydir/'] );
assert.deepEqual( files, ['local:local.mfn'] );
assert.deepEqual( files, ['local:local.mfn', 'local:local2.mfn'] );
});

QUnit.test( "open dir", function( assert ) {
Expand Down Expand Up @@ -71,7 +71,7 @@ QUnit.test( "breadcrumbs", function( assert ) {
});

QUnit.test( "refresh", function( assert ) {
Api.setResponseForCall('listManifests', [{'path': 's3:mfns/'}, {'path': 'refresh.mfn'}]);
Api.setResponseForCall('listManifests', [{'path': ''}, {'path': 's3:mfns/'}, {'path': 'refresh.mfn'}]);

// dig in
$('#open-archive a.folders')[0].click();
Expand All @@ -88,7 +88,7 @@ QUnit.test( "refresh", function( assert ) {
});

QUnit.test( "open archive and download", function( assert ) {
Api.setResponseForCall('scanManifest', [{'path': 'zdir/'}, {'path': '1.txt'}]);
Api.setResponseForCall('scanManifest', [{'path': ''}, {'path': 'zdir/'}, {'path': '1.txt'}]);

$('#open-archive a.files')[0].click();

Expand All @@ -110,3 +110,18 @@ QUnit.test( "open archive and download", function( assert ) {

assert.deepEqual(Api.calls(), ['downloadArchive(local:local.mfn)']);
});

QUnit.test( "open archive with absolute paths", function( assert ) {
Api.setResponseForCall('scanManifest', [{'path': '/'}, {'path': '/dir/'}, {'path': '/dir/file.txt'}]);

$('#open-archive a.files')[1].click();

assert.equal(window.location.hash, '#local:local2.mfn');
assert.deepEqual(Api.calls(), ['scanManifest(local:local2.mfn)']);

var folders = getFolders('local:local2.mfn');
var files = getFiles('local:local2.mfn');

assert.deepEqual( folders, ['/dir/'] );
assert.deepEqual( files, [] );
});

0 comments on commit 3348cf3

Please sign in to comment.