-
-
Save steffen-workpath/e66184e671a6019025704ee2dfe64797 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule KeyResultTest do | |
use ExUnit.Case | |
doctest KeyResult | |
test "calculates progress for binary KRs" do | |
assert KeyResult.progress(%KeyResult{done: true}) == 1 | |
assert KeyResult.progress(%KeyResult{done: false}) == 0 | |
end | |
test "calculates progress for metrics KRs" do | |
assert KeyResult.progress(%KeyResult{start: 0.0, target: 1.0, actual: 0.5}) == 0.5 | |
assert KeyResult.progress(%KeyResult{start: 0.0, target: 10.0, actual: 5.0}) == 0.5 | |
assert KeyResult.progress(%KeyResult{start: 0.0, target: 100.0, actual: 200.0}) == 2.0 | |
end | |
end | |
defmodule GoalTest do | |
use ExUnit.Case | |
doctest Goal | |
test "calculates progress for goals" do | |
g = %Goal{ | |
krs: [ | |
%KeyResult{desc: "Do hackathon", done: true}, | |
%KeyResult{desc: "Get 100 claps on Medium post", start: 0, target: 100, actual: 0} | |
] | |
} | |
assert Goal.progress(g) == 0.5 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment