PkgTemplates.jl/test/plugins/codecov.jl

42 lines
1.4 KiB
Julia
Raw Normal View History

2017-10-02 01:43:03 +00:00
t = Template(; user=me)
2018-09-28 20:30:10 +00:00
pkg_dir = joinpath(t.dir, test_pkg)
2017-10-02 01:43:03 +00:00
2018-11-05 22:05:30 +00:00
@testset "Codecov" begin
2017-10-02 01:43:03 +00:00
@testset "Plugin creation" begin
2018-11-05 22:05:30 +00:00
p = Codecov()
2017-10-02 01:43:03 +00:00
@test p.gitignore == ["*.jl.cov", "*.jl.*.cov", "*.jl.mem"]
@test p.src === nothing
2017-10-02 01:43:03 +00:00
@test p.dest == ".codecov.yml"
@test p.badges == [
Badge(
2018-11-05 22:05:30 +00:00
"Codecov",
2017-10-02 01:43:03 +00:00
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl/branch/master/graph/badge.svg",
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl",
)
]
@test isempty(p.view)
2018-11-05 22:05:30 +00:00
p = Codecov(; config_file=nothing)
@test p.src === nothing
2018-11-05 22:05:30 +00:00
p = Codecov(; config_file=test_file)
@test p.src == test_file
2018-11-05 22:05:30 +00:00
@test_throws ArgumentError Codecov(; config_file=fake_path)
2017-10-02 01:43:03 +00:00
end
@testset "Badge generation" begin
2018-11-05 22:05:30 +00:00
p = Codecov()
@test badges(p, me, test_pkg) == ["[![Codecov](https://codecov.io/gh/$me/$test_pkg.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/$me/$test_pkg.jl)"]
2017-10-02 01:43:03 +00:00
end
@testset "File generation" begin
2018-11-05 22:05:30 +00:00
p = Codecov()
2018-09-28 20:30:10 +00:00
@test isempty(gen_plugin(p, t, test_pkg))
2017-10-02 01:43:03 +00:00
@test !isfile(joinpath(pkg_dir, ".codecov.yml"))
2018-09-28 20:30:10 +00:00
2018-11-05 22:05:30 +00:00
p = Codecov(; config_file=test_file)
2018-09-28 20:30:10 +00:00
@test gen_plugin(p, t, test_pkg) == [".codecov.yml"]
@test isfile(joinpath(pkg_dir, ".codecov.yml"))
2017-10-02 01:43:03 +00:00
end
end
2018-09-28 20:30:10 +00:00
rm(pkg_dir; recursive=true)