with_mock_dir("exposure",{ test_that("catch missing DTXSID", { expect_error(get_exposure_functional_use(API_key = 'test_key'), 'Please input an DTXSID!') expect_error(get_exposure_functional_use_probability(API_key = 'test_key'), 'Please input an DTXSID!') expect_error(get_httk_data(API_key = 'test_key'), 'Please input an DTXSID!') expect_error(get_exposure_product_data(API_key = 'test_key'), 'Please input an DTXSID!') expect_error(get_exposure_list_presence_tags_by_dtxsid(API_key = 'test_key'), 'Please input an DTXSID!') expect_error(get_general_exposure_prediction(API_key = 'test_key'), 'Please input an DTXSID!') expect_error(get_demographic_exposure_prediction(API_key = 'test_key'), 'Please input an DTXSID!') expect_error(get_single_sample_records_by_dtxsid(API_key = 'test_key'), 'Please input a DTXSID!') expect_error(get_aggregate_records_by_dtxsid(API_key = 'test_key'), 'Please input a DTXSID!') expect_error(get_single_sample_records_by_medium(API_key = 'test_key'), 'Please input a Medium!') expect_error(get_aggregate_records_by_medium(API_key = 'test_key'), 'Please input a Medium!') expect_error(get_product_use_category(API_key = 'test_key'), 'Please input a DTXSID!') expect_error(get_production_volume(API_key = 'test_key'), 'Please input a DTXSID!') expect_error(get_biomonitoring_data(API_key = 'test_key'), 'Please input a DTXSID!') expect_error(get_general_use_keywords(API_key = 'test_key'), 'Please input a DTXSID!') expect_error(get_reported_functional_use(API_key = 'test_key'), 'Please input a DTXSID!') expect_error(get_chemical_weight_fraction(API_key = 'test_key'), 'Please input a DTXSID!') }) test_that("Return data type", { expect_type(get_exposure_functional_use(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_exposure_functional_use(DTXSID = '', API_key = ctx_key()), 'NULL') expect_type(get_exposure_functional_use_probability(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_exposure_functional_use_probability(DTXSID = '', API_key = ctx_key()), 'NULL') expect_type(get_exposure_functional_use_category(API_key = ctx_key()), 'list') expect_type(get_httk_data(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_httk_data(DTXSID = '', API_key = ctx_key()), 'NULL') expect_type(get_exposure_product_data(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_exposure_product_data(DTXSID = '', API_key = ctx_key()), 'NULL') expect_type(get_exposure_product_data_puc(API_key = ctx_key()), 'list') expect_type(get_exposure_list_presence_tags(API_key = ctx_key()), 'list') expect_type(get_exposure_list_presence_tags_by_dtxsid(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_exposure_list_presence_tags_by_dtxsid(DTXSID = '', API_key = ctx_key()), 'NULL') expect_type(get_general_exposure_prediction(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_general_exposure_prediction(DTXSID = '', API_key = ctx_key()), 'NULL') expect_type(get_demographic_exposure_prediction(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_demographic_exposure_prediction(DTXSID = '', API_key = ctx_key()), 'NULL') #expect_type(get_single_sample_records_by_dtxsid(DTXSID = 'DTXSID0020232', API_key = ctx_key()), 'list') expect_type(get_single_sample_records_by_dtxsid(DTXSID = '', API_key = ctx_key()), 'NULL') expect_type(get_aggregate_records_by_dtxsid(DTXSID = 'DTXSID0020232', API_key = ctx_key()), 'list') expect_type(get_aggregate_records_by_dtxsid(DTXSID = '', API_key = ctx_key()), 'NULL') expect_type(get_single_sample_records_by_medium(Medium = '', API_key = ctx_key()), 'list') expect_type(get_aggregate_records_by_medium(Medium = '', API_key = ctx_key()), 'list') expect_type(get_product_use_category(DTXSID = 'DTXSID0020232', API_key = ctx_key()), 'list') expect_type(get_product_use_category(DTXSID = '', API_key = ctx_key()), 'NULL') expect_type(get_production_volume(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_production_volume(DTXSID = '', API_key = ctx_key()), 'NULL') expect_type(get_biomonitoring_data(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_biomonitoring_data(DTXSID = '', API_key = ctx_key()), 'NULL') expect_type(get_general_use_keywords(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_general_use_keywords(DTXSID = '', API_key = ctx_key()), 'NULL') expect_type(get_reported_functional_use(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_reported_functional_use(DTXSID = '', API_key = ctx_key()), 'NULL') expect_type(get_chemical_weight_fraction(DTXSID = 'DTXSID7020182', API_key = ctx_key()), 'list') expect_type(get_chemical_weight_fraction(DTXSID = '', API_key = ctx_key()), 'NULL') })})