Skip to content

Commit

Permalink
fixed some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinuzziFrancesco committed Dec 18, 2024
1 parent 1e53a7c commit 0f173b7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/utils.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using SpectralIndices

# Test correctness
@test SpectralIndices._load_json("spectral-indices-dict.json") isa Dict
@test SpectralIndices.load_json("spectral-indices-dict.json") isa Dict
# Test missing
@test_throws ErrorException SpectralIndices._load_json("non_existing_file.json")
@test_throws ErrorException SpectralIndices.load_json("non_existing_file.json")

# Test offline
@test SpectralIndices._get_indices() isa Dict
@test SpectralIndices.get_indices() isa Dict
# Test online
@testset "Download Indices Test" begin
test_dir = mktempdir()
Expand All @@ -15,7 +15,7 @@ using SpectralIndices
test_fileloc = test_dir

# Run the _get_indices function with online = true
indices = SpectralIndices._get_indices(true; fileloc=test_fileloc)
indices = SpectralIndices.get_indices(true; fileloc=test_fileloc)

# Test if the file was downloaded and parsed successfully
@test isfile(joinpath(test_dir, "spectral-indices-dict.json"))
Expand Down Expand Up @@ -44,6 +44,6 @@ end

params = Dict("N" => 0.6, "R" => 0.3)
# Test correctness
@test SpectralIndices._check_params(NDVI, params) === nothing
@test SpectralIndices.check_params(NDVI, params) === nothing
# Test missing
@test_throws ArgumentError SpectralIndices._check_params(NDVI, Dict("N" => 0.6))
@test_throws ArgumentError SpectralIndices.check_params(NDVI, Dict("N" => 0.6))

0 comments on commit 0f173b7

Please sign in to comment.