Jasmine test for a method in Entity type


#1

Hello,
I’m trying to test a method in one of my entity types and I’m having trouble to figure out how jasmine tests can be written to this method.

The MeasurementType.load() method basically takes HDF5 files as an input and loads data from the file to MeasurementType and MeasurementSeriesType. HDF5 files are compressed files and the data can be viewed using external tools. To support HDF5 in the platform, HDF5 type is added with recent update(v 7.8) to the platform. My idea was to mock some sample data to the method and test its functionality, since the data in the file is dynamic I figured that it is difficult to follow that path. Can somebody help me with some ideas to test the method. Thank you

function load(hdf5File) {
var x = Hdf5.readObj(hdf5File);
.
.
.
.
.
.
MeasurementType.upsertBatch([MeasurementType.make()]);
MeasurementSeriesType.upsertBatch(MeasurementSeriesType.make());
}


#2

You should split you function into different functionalities and test each of them separately.