42 lines
No EOL
1 KiB
TypeScript
42 lines
No EOL
1 KiB
TypeScript
import { DataFileServiceImpl } from './datafile.service.impl';
|
|
import { Mock } from 'ts-mocks';
|
|
|
|
|
|
describe("DataFileServiceImpl", () => {
|
|
var dataFileServiceImpl: DataFileServiceImpl;
|
|
var fileReaderMock: Mock<FileReader>;
|
|
var fileReader: FileReader;
|
|
|
|
beforeEach(() => {
|
|
fileReaderMock = new Mock<FileReader>();
|
|
fileReader = fileReaderMock.Object;
|
|
dataFileServiceImpl = new DataFileServiceImpl(() => fileReader);
|
|
});
|
|
|
|
describe("blobToString", () => {
|
|
|
|
beforeEach(() => {
|
|
fileReaderMock.setup(mock => mock.readAsText).is((blob: Blob) => {
|
|
fileReaderMock.Object.onload(<any>{target: {result: blob.toString()}});
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
describe("arrayToString", () => {
|
|
|
|
beforeEach(() => {
|
|
fileReaderMock.setup(mock => mock.readAsArrayBuffer).is((blob: Blob) => {
|
|
fileReaderMock.Object.onload(<any>{target: {result: blob.toString()}});
|
|
});
|
|
});
|
|
});
|
|
|
|
describe("readDataArrayAsPossibleArchive", () => {
|
|
|
|
});
|
|
|
|
describe("downloadDataFileAsArrayBuffer", () => {
|
|
|
|
});
|
|
}); |