11import { TestBed } from '@angular/core/testing' ;
22
33import { ProductService } from './product.service' ;
4+ import * as models from '@models' ;
45
56describe ( 'ProductService' , ( ) => {
67 let service : ProductService ;
@@ -16,34 +17,44 @@ describe('ProductService', () => {
1617 it ( 'should parse old links correctly' , ( ) => {
1718 const url =
1819 'https://datapool.asf.alaska.edu/RTC/OPERA-S1/OPERA_L2_RTC-S1_T001-000189-IW2_20211028T180924Z_20250703T015334Z_S1A_30_v1.0_VH.tif' ;
19- expect ( service . urlToProductType ( url ) ) . toBe ( 'VH' ) ;
20+ expect ( service . urlToProductType ( url , models . opera_s1 . productTypeDisplays ) ) . toBe ( 'VH' ) ;
2021 } ) ;
2122 it ( 'should parse h5 cumulus link' , ( ) => {
2223 const url =
2324 'https://cumulus.asf.earthdatacloud.nasa.gov/OPERA/OPERA_L2_RTC-S1/OPERA_L2_RTC-S1_T139-297356-IW2_20250929T054926Z_20251002T213318Z_S1C_30_v1.0/OPERA_L2_RTC-S1_T139-297356-IW2_20250929T054926Z_20251002T213318Z_S1C_30_v1.0_VH.tif' ;
24- expect ( service . urlToProductType ( url ) ) . toBe ( 'VH' ) ;
25+ expect ( service . urlToProductType ( url , models . opera_s1 . productTypeDisplays ) ) . toBe ( 'VH' ) ;
2526 } ) ;
2627 it ( 'should parse a base download url' , ( ) => {
2728 const url =
2829 'https://cumulus.asf.earthdatacloud.nasa.gov/OPERA/OPERA_L2_RTC-S1/OPERA_L2_RTC-S1_T140-299545-IW1_20250929T073003Z_20251003T012020Z_S1C_30_v1.0/OPERA_L2_RTC-S1_T140-299545-IW1_20250929T073003Z_20251003T012020Z_S1C_30_v1.0.h5' ;
29- expect ( service . urlToProductType ( url ) ) . toBe ( 'h5' ) ;
30+ expect ( service . urlToProductType ( url , models . opera_s1 . productTypeDisplays ) ) . toBe ( 'h5' ) ;
3031 } ) ;
3132 it ( 'should parse links with more than one word' , ( ) => {
3233 const datapool =
3334 'https://datapool.asf.alaska.edu/RTC-STATIC/OPERA-S1/OPERA_L2_RTC-S1-STATIC_T144-308004-IW3_20140403_S1A_30_v1.0_number_of_looks.tif' ;
3435 const cumulus =
3536 'https://cumulus.asf.earthdatacloud.nasa.gov/OPERA/OPERA-S1/OPERA_L2_RTC-S1-STATIC_T144-308004-IW3_20140403_S1A_30_v1.0_number_of_looks.tif' ;
36- expect ( service . urlToProductType ( datapool ) ) . toBe ( 'number_of_looks' ) ;
37- expect ( service . urlToProductType ( cumulus ) ) . toBe ( 'number_of_looks' ) ;
37+ expect ( service . urlToProductType ( datapool , models . opera_s1 . productTypeDisplays ) ) . toBe ( 'number_of_looks' ) ;
38+ expect ( service . urlToProductType ( cumulus , models . opera_s1 . productTypeDisplays ) ) . toBe ( 'number_of_looks' ) ;
3839 } ) ;
3940 it ( 'should parse xml cumulus link' , ( ) => {
4041 const url =
4142 'https://cumulus.asf.earthdatacloud.nasa.gov/OPERA/OPERA_L4_TROPO-ZENITH_V1/OPERA_L4_TROPO-ZENITH_20251003T180000Z_20251006T000715Z_HRES_v1.0/OPERA_L4_TROPO-ZENITH_20251003T180000Z_20251006T000715Z_HRES_v1.0.iso.xml' ;
42- expect ( service . urlToProductType ( url ) ) . toBe ( 'xml' ) ;
43+ expect ( service . urlToProductType ( url , models . opera_s1 . productTypeDisplays ) ) . toBe ( 'xml' ) ;
4344 } ) ;
4445 it ( 'should parse netcdf cumulus link' , ( ) => {
4546 const url =
4647 'https://cumulus.asf.earthdatacloud.nasa.gov/OPERA/OPERA_L4_TROPO-ZENITH_V1/OPERA_L4_TROPO-ZENITH_20251003T180000Z_20251006T000715Z_HRES_v1.0/OPERA_L4_TROPO-ZENITH_20251003T180000Z_20251006T000715Z_HRES_v1.0.nc' ;
47- expect ( service . urlToProductType ( url ) ) . toBe ( 'nc' ) ;
48+ expect ( service . urlToProductType ( url , models . opera_s1 . productTypeDisplays ) ) . toBe ( 'nc' ) ;
49+ } ) ;
50+ it ( 'should parse seasat hdf5 link' , ( ) => {
51+ const url =
52+ 'https://cumulus.asf.earthdatacloud.nasa.gov/SEASAT/SS_01502_STD_F2536/SS_01502_STD_F2536.h5' ;
53+ expect ( service . urlToProductType ( url , models . seasat . productTypeDisplays ) ) . toBe ( 'h5' ) ;
54+ } ) ;
55+ it ( 'should parse seasat geotiff s3 link' , ( ) => {
56+ const url =
57+ 'https://cumulus.asf.earhtdatacloud.nasa.gov/SEASAT/SS_01502_STD_F2536/SS_01502_STD_F2536.tif' ;
58+ expect ( service . urlToProductType ( url , models . seasat . productTypeDisplays ) ) . toBe ( 'tif' ) ;
4859 } ) ;
4960} ) ;
0 commit comments