The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/tests/unit/client/lib/download.spec.ts

58 lines
1.3 KiB

import { expect, spy } from 'chai';
import { describe, it } from 'mocha';
import { download, downloadAs, downloadCsvAs, downloadJsonAs } from '../../../../client/lib/download';
describe('download', () => {
it('should work', () => {
const listener = spy();
document.addEventListener('click', listener, false);
download('about:blank', 'blank');
document.removeEventListener('click', listener, false);
expect(listener).to.have.been.called();
});
});
describe('downloadAs', () => {
it('should work', () => {
const listener = spy();
document.addEventListener('click', listener, false);
downloadAs({ data: [] }, 'blank');
document.removeEventListener('click', listener, false);
expect(listener).to.have.been.called();
});
});
describe('downloadJsonAs', () => {
it('should work', () => {
const listener = spy();
document.addEventListener('click', listener, false);
downloadJsonAs({}, 'blank');
document.removeEventListener('click', listener, false);
expect(listener).to.have.been.called();
});
});
describe('downloadCsvAs', () => {
it('should work', () => {
const listener = spy();
document.addEventListener('click', listener, false);
downloadCsvAs(
[
[1, 2, 3],
[4, 5, 6],
],
'blank',
);
document.removeEventListener('click', listener, false);
expect(listener).to.have.been.called();
});
});