diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/activity_spec.lua | 49 | ||||
-rw-r--r-- | spec/dates_spec.lua | 3 |
2 files changed, 52 insertions, 0 deletions
diff --git a/spec/activity_spec.lua b/spec/activity_spec.lua new file mode 100644 index 0000000..634a228 --- /dev/null +++ b/spec/activity_spec.lua @@ -0,0 +1,49 @@ +local activity = require "activity" +local plain = require "activity.formats.plain" + +local Y2024 = [[ + _0000000000000000000000000000000000000000000000000000 +Mon 00000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000 +Wed 0000000000000000000000000000000000000000000000000000_ + 0000000000000000000000000000000000000000000000000000_ +Fri 0000000000000000000000000000000000000000000000000000_ + 0000000000000000000000000000000000000000000000000000_ +]] + +local Y2023 = [[ + 00000000000000000000000000000000000000000000000000000 +Mon 0000000000000000000000000000000000000000000000000000_ + 0000000000000000000000000000000000000000000000000000_ +Wed 0000000000000000000000000000000000000000000000000000_ + 0000000000000000000000000000000000000000000000000000_ +Fri 0000000000000000000000000000000000000000000000000000_ + 0000000000000000000000000000000000000000000000000000_ +]] + +local Y2020 = [[ + _0000000000000000000000000000000000000000000000000000 +Mon _0000000000000000000000000000000000000000000000000000 + _0000000000000000000000000000000000000000000000000000 +Wed 00000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000 +Fri 0000000000000000000000000000000000000000000000000000_ + 0000000000000000000000000000000000000000000000000000_ +]] + + +describe("Generator", function() + describe("shall generate correct table for year", function() + it("2024", function() + assert.are.equal(Y2024, activity.generate_table(2024, {}, plain)) + end) + + it("2023", function() + assert.are.equal(Y2023, activity.generate_table(2023, {}, plain)) + end) + + it("2020", function() + assert.are.equal(Y2020, activity.generate_table(2020, {}, plain)) + end) + end) +end) diff --git a/spec/dates_spec.lua b/spec/dates_spec.lua index 1c5382e..b1d3594 100644 --- a/spec/dates_spec.lua +++ b/spec/dates_spec.lua @@ -1,5 +1,6 @@ local dates = require "activity.dates" + describe("Days in a year", function() it("should support regular years", function() assert.are.equal(365, dates.days_in(1970)) @@ -20,6 +21,7 @@ describe("Days in a year", function() end) end) + describe("This year is", function() local this_year = tonumber(os.date"%Y") -- Quite useless test @@ -28,6 +30,7 @@ describe("This year is", function() end) end) + describe("First week day of", function() it("2023 is Sunday", function() assert.are.equal(1, dates.first_week_day(2023)) |