diff options
Diffstat (limited to 'tests/mason-core/optional_spec.lua')
| -rw-r--r-- | tests/mason-core/optional_spec.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/mason-core/optional_spec.lua b/tests/mason-core/optional_spec.lua index e0068b10..4e6b1325 100644 --- a/tests/mason-core/optional_spec.lua +++ b/tests/mason-core/optional_spec.lua @@ -61,3 +61,17 @@ describe("Optional.if_present()", function() assert.spy(present).was_called_with "value" end) end) + +describe("Optional.if_not_present()", function() + it("should not call .if_not_present() if value is not empty", function() + local present = spy.new() + Optional.of_nilable("value"):if_not_present(present) + assert.spy(present).was_not_called() + end) + + it("should call .if_not_present() if value is empty", function() + local present = spy.new() + Optional.empty():if_not_present(present) + assert.spy(present).was_called(1) + end) +end) |
