CARTAvis / carta-frontend

Source code repository for the frontend component of CARTA, a new visualization tool designed for the ALMA, the VLA and the SKA pathfinders.
https://cartavis.github.io/
GNU General Public License v3.0
20 stars 10 forks source link

Add frontend unit test of SpectralProfile.rawValuesFp64 #2369

Open acdo2002 opened 7 months ago

acdo2002 commented 7 months ago

Describe the motivation We move the conversion of rawValuesFp64 to float number test to the frontend unit test. ICD-RxJS tests focus on the protobuf communication between the frontend and the backend, ICD-RxJS tests are only testing the compressed rawValuesFp64.

The conversion of rawValuesFp64 to float number is located in carta-frontend/src/utilities/Processed/Processed.ts line 59 ProcessSpectralProfile

The frontend unit test will test this line: new Float64Array(profile.rawValuesFp64.slice().buffer)

Expected behavior An example for the frontend unit test:

Should convert the unit8Array

SpectralProfile { coordinate: 'z', statsType: 4, rawValuesFp64: Uint8Array(40) [ 254, 200, 105, 252, 224, 108, 150, 63, 116, 209, 69, 71, 156, 152, 146, 63, 250, 90, 61, 131, 156, 74, 162, 63, 80, 42, 76, 112, 43, 3, 147, 63, 195, 196, 251, 25, 238, 78, 149, 63 ] }

to actual coordinate

{
  coordinate: 'z',
  statsType: 4,
  values: Float64Array(5) [
    0.021899714857178225,
    0.01816028771413998,
    0.035725489635913335,
    0.018566778878304213,
    0.02080890687551996
  ],
  progress: 1
}