Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable27] Fix jsunit tests #40638

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/files/tests/js/fileUploadSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('OC.Upload tests', function() {
});
it('does not add file if it exceeds free space', function(done) {
var result;
$('#free_space').val(1000);
$('#free_space').val(1024);

failStub.callsFake(function(){
expect(failStub.calledOnce).toEqual(true);
Expand Down
6 changes: 3 additions & 3 deletions apps/files/tests/js/filelistSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ describe('OCA.Files.FileList tests', function() {
expect($summary.find('.fileinfo').text()).toEqual('2 files');
expect($summary.find('.dirinfo').hasClass('hidden')).toEqual(false);
expect($summary.find('.fileinfo').hasClass('hidden')).toEqual(false);
expect($summary.find('.filesize').text()).toEqual('70 KB');
expect($summary.find('.filesize').text()).toEqual('69 KB');
expect(fileList.isEmpty).toEqual(false);
});
it('Shows empty content when removing last file', function() {
Expand Down Expand Up @@ -609,7 +609,7 @@ describe('OCA.Files.FileList tests', function() {
expect($summary.find('.fileinfo').text()).toEqual('1 file');
expect($summary.find('.dirinfo').hasClass('hidden')).toEqual(false);
expect($summary.find('.fileinfo').hasClass('hidden')).toEqual(false);
expect($summary.find('.filesize').text()).toEqual('58 KB');
expect($summary.find('.filesize').text()).toEqual('57 KB');
expect(fileList.isEmpty).toEqual(false);
expect($('.files-filestable thead th').hasClass('hidden')).toEqual(false);
expect($('.emptyfilelist.emptycontent').hasClass('hidden')).toEqual(true);
Expand Down Expand Up @@ -1138,7 +1138,7 @@ describe('OCA.Files.FileList tests', function() {
expect($summary.hasClass('hidden')).toEqual(false);
expect($summary.find('.dirinfo').text()).toEqual('1 folder');
expect($summary.find('.fileinfo').text()).toEqual('3 files');
expect($summary.find('.filesize').text()).toEqual('70 KB');
expect($summary.find('.filesize').text()).toEqual('69 KB');
});
it('shows headers, summary and hide empty content message after setting files', function(){
fileList.setFiles(testFiles);
Expand Down
42 changes: 21 additions & 21 deletions apps/files/tests/js/filesummarySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('OCA.Files.FileSummary tests', function() {
s.setSummary({
totalDirs: 5,
totalFiles: 2,
totalSize: 256000
totalSize: 256*1024,
});
expect($container.hasClass('hidden')).toEqual(false);
expect($container.find('.dirinfo').text()).toEqual('5 folders');
Expand All @@ -60,9 +60,9 @@ describe('OCA.Files.FileSummary tests', function() {
s.setSummary({
totalDirs: 5,
totalFiles: 2,
totalSize: 256000
totalSize: 256*1024
});
s.add({type: 'file', size: 256000});
s.add({type: 'file', size: 256*1024});
s.add({type: 'dir', size: 100});
s.update();
expect($container.hasClass('hidden')).toEqual(false);
Expand All @@ -71,16 +71,16 @@ describe('OCA.Files.FileSummary tests', function() {
expect($container.find('.filesize').text()).toEqual('512 KB');
expect(s.summary.totalDirs).toEqual(6);
expect(s.summary.totalFiles).toEqual(3);
expect(s.summary.totalSize).toEqual(512100);
expect(s.summary.totalSize).toEqual(512*1024 + 100);
});
it('decreases summary when removing files', function() {
var s = new FileSummary($container);
s.setSummary({
totalDirs: 5,
totalFiles: 2,
totalSize: 256000
totalSize: 256*1024
});
s.remove({type: 'file', size: 128000});
s.remove({type: 'file', size: 128*1024});
s.remove({type: 'dir', size: 100});
s.update();
expect($container.hasClass('hidden')).toEqual(false);
Expand All @@ -89,15 +89,15 @@ describe('OCA.Files.FileSummary tests', function() {
expect($container.find('.filesize').text()).toEqual('128 KB');
expect(s.summary.totalDirs).toEqual(4);
expect(s.summary.totalFiles).toEqual(1);
expect(s.summary.totalSize).toEqual(127900);
expect(s.summary.totalSize).toEqual(128*1024 - 100);
});

it('renders filtered summary as text', function() {
var s = new FileSummary($container);
s.setSummary({
totalDirs: 5,
totalFiles: 2,
totalSize: 256000,
totalSize: 256*1024,
filter: 'foo'
});
expect($container.hasClass('hidden')).toEqual(false);
Expand All @@ -121,11 +121,11 @@ describe('OCA.Files.FileSummary tests', function() {
s.setSummary({
totalDirs: 5,
totalFiles: 2,
totalSize: 256000,
totalSize: 256*1024,
filter: 'foo'
});
s.add({name: 'bar.txt', type: 'file', size: 256000});
s.add({name: 'foo.txt', type: 'file', size: 256001});
s.add({name: 'bar.txt', type: 'file', size: 256*1024});
s.add({name: 'foo.txt', type: 'file', size: 256*1024 + 1});
s.add({name: 'bar', type: 'dir', size: 100});
s.add({name: 'foo', type: 'dir', size: 102});
s.update();
Expand All @@ -136,18 +136,18 @@ describe('OCA.Files.FileSummary tests', function() {
expect($container.find('.filesize').text()).toEqual('512 KB');
expect(s.summary.totalDirs).toEqual(6);
expect(s.summary.totalFiles).toEqual(3);
expect(s.summary.totalSize).toEqual(512103);
expect(s.summary.totalSize).toEqual(512*1024 + 1 + 102);
});
it('decreases filtered summary when removing files', function() {
var s = new FileSummary($container);
s.setSummary({
totalDirs: 5,
totalFiles: 2,
totalSize: 256000,
totalSize: 256*1024,
filter: 'foo'
});
s.remove({name: 'bar.txt', type: 'file', size: 128000});
s.remove({name: 'foo.txt', type: 'file', size: 127999});
s.remove({name: 'bar.txt', type: 'file', size: 128*1024});
s.remove({name: 'foo.txt', type: 'file', size: 128*1024 - 1});
s.remove({name: 'bar', type: 'dir', size: 100});
s.remove({name: 'foo', type: 'dir', size: 98});
s.update();
Expand All @@ -158,7 +158,7 @@ describe('OCA.Files.FileSummary tests', function() {
expect($container.find('.filesize').text()).toEqual('128 KB');
expect(s.summary.totalDirs).toEqual(4);
expect(s.summary.totalFiles).toEqual(1);
expect(s.summary.totalSize).toEqual(127903);
expect(s.summary.totalSize).toEqual(256*1024 - (128*1024 - 1) - 98);
});
it('properly sum up pending folder sizes after adding', function() {
var s = new FileSummary($container);
Expand Down Expand Up @@ -206,9 +206,9 @@ describe('OCA.Files.FileSummary tests', function() {
it('renders hidden count section when hidden files are hidden', function() {
window._nc_event_bus.emit('files:config:updated', { key: 'show_hidden', value: false });

summary.add({name: 'abc', type: 'file', size: 256000});
summary.add({name: 'abc', type: 'file', size: 256*1024});
summary.add({name: 'def', type: 'dir', size: 100});
summary.add({name: '.hidden', type: 'dir', size: 512000});
summary.add({name: '.hidden', type: 'dir', size: 512*1024});
summary.update();
expect($container.hasClass('hidden')).toEqual(false);
expect($container.find('.dirinfo').text()).toEqual('2 folders');
Expand All @@ -220,9 +220,9 @@ describe('OCA.Files.FileSummary tests', function() {
it('does not render hidden count section when hidden files exist but are visible', function() {
window._nc_event_bus.emit('files:config:updated', { key: 'show_hidden', value: true });

summary.add({name: 'abc', type: 'file', size: 256000});
summary.add({name: 'abc', type: 'file', size: 256*1024});
summary.add({name: 'def', type: 'dir', size: 100});
summary.add({name: '.hidden', type: 'dir', size: 512000});
summary.add({name: '.hidden', type: 'dir', size: 512*1024});
summary.update();
expect($container.hasClass('hidden')).toEqual(false);
expect($container.find('.dirinfo').text()).toEqual('2 folders');
Expand All @@ -233,7 +233,7 @@ describe('OCA.Files.FileSummary tests', function() {
it('does not render hidden count section when no hidden files exist', function() {
window._nc_event_bus.emit('files:config:updated', { key: 'show_hidden', value: false });

summary.add({name: 'abc', type: 'file', size: 256000});
summary.add({name: 'abc', type: 'file', size: 256*1024});
summary.add({name: 'def', type: 'dir', size: 100});
summary.update();
expect($container.hasClass('hidden')).toEqual(false);
Expand Down
2 changes: 1 addition & 1 deletion apps/files/tests/js/mainfileinfodetailviewSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('OCA.Files.MainFileInfoDetailView tests', function() {
view.setFileInfo(testFileInfo);
expect(view.$el.find('.fileName h3').text()).toEqual('One.txt');
expect(view.$el.find('.fileName h3').attr('title')).toEqual('One.txt');
expect(view.$el.find('.size').text()).toEqual('123.5 MB');
expect(view.$el.find('.size').text()).toEqual('117.7 MB');
expect(view.$el.find('.size').attr('title')).toEqual('123456789 bytes');
expect(view.$el.find('.date').text()).toEqual('seconds ago');
expect(view.$el.find('.date').attr('title')).toEqual(dateExpected);
Expand Down
Loading