| Conditions | 7 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package timeago |
||
| 5 | func TestOptionIsEnabled(t *testing.T) { |
||
| 6 | t.Run("returns true if option is enabled", func(test *testing.T) { |
||
| 7 | options = []opt{OptNoSuffix} |
||
| 8 | |||
| 9 | if res := optionIsEnabled(OptNoSuffix); res == false { |
||
| 10 | test.Error("Result must be true, but got false instead") |
||
| 11 | } |
||
| 12 | |||
| 13 | options = []opt{} |
||
| 14 | }) |
||
| 15 | |||
| 16 | t.Run("returns true if option is enabled with other option", func(test *testing.T) { |
||
| 17 | options = []opt{OptNoSuffix, OptUpcoming} |
||
| 18 | |||
| 19 | if res := optionIsEnabled(OptUpcoming); res == false { |
||
| 20 | test.Error("Result must be true, but got false instead") |
||
| 21 | } |
||
| 22 | |||
| 23 | options = []opt{} |
||
| 24 | }) |
||
| 25 | |||
| 26 | t.Run("returns false if option is disabled", func(test *testing.T) { |
||
| 27 | if res := optionIsEnabled(OptNoSuffix); res == true { |
||
| 28 | test.Error("Result must be true, but got false instead") |
||
| 29 | } |
||
| 32 |