Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bluesmoon committed Oct 18, 2023
1 parent 05db8cc commit bf45bc3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
14 changes: 14 additions & 0 deletions test/beacon-api.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
config = mPulseAPI.getBeaconConfig(beaconKey, "mPulseAPIDemo.net")

@test config isa Dict
@test haskey(config, "h.cr")
@test haskey(config, "h.d")
@test haskey(config, "h.key")
@test haskey(config, "h.t")

t_end = Int(datetime2unix(now())*1000)
@test mPulseAPI.sendBeacon(config, Dict("PageGroup" => "mPulseAPI Test", "tDone" => t_end - t_start), "Conversion" => 1, "ResourceTimer" => 500, "Url" => "https://github.com/akamai/mPulseAPI.jl/")

config2 = mPulseAPI.getBeaconConfig(beaconKey, "mPulseAPIDemo.net")

@test config == config2
2 changes: 1 addition & 1 deletion test/repository-tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ domainNames = map(d -> d["name"], domains)
@test "mPulseAPI Test" domainNames

# Get a specific domain
appKey = filter(d -> d["name"] == "mPulseAPI Test", domains)[1]["attributes"]["appKey"]
beaconKey = appKey = filter(d -> d["name"] == "mPulseAPI Test", domains)[1]["attributes"]["appKey"]
@test !isempty(appKey)

domain = getRepositoryDomain(token, appKey=appKey)
Expand Down
7 changes: 6 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using mPulseAPI
using Test
using Test, Dates

# Check environment
if !haskey(ENV, "mPulseAPIToken")
Expand Down Expand Up @@ -28,6 +28,7 @@ end

mPulseAPI.setVerbose(verbosity)

t_start = Int(datetime2unix(now())*1000)

@testset "mPulseAPI" begin
@testset "Repository" begin
Expand All @@ -42,6 +43,10 @@ mPulseAPI.setVerbose(verbosity)
include("query-tests.jl")
end

@testset "Beacons" begin
include("beacon-api.jl")
end

@testset "Change URL" begin
include("zzz_change-url-tests.jl")
end
Expand Down

0 comments on commit bf45bc3

Please sign in to comment.