From 9394bcc5c582e737f0ff6bba1e411f97ee9c8c5d Mon Sep 17 00:00:00 2001 From: William Boman Date: Thu, 8 Dec 2022 02:06:23 +0100 Subject: test(functional): add some tests (#742) Forgot to include these in the last commit. --- tests/mason-core/functional/function_spec.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/mason-core/functional/function_spec.lua') diff --git a/tests/mason-core/functional/function_spec.lua b/tests/mason-core/functional/function_spec.lua index 28abce20..23af1933 100644 --- a/tests/mason-core/functional/function_spec.lua +++ b/tests/mason-core/functional/function_spec.lua @@ -146,4 +146,18 @@ describe("functional: function", function() assert.spy(fn).was_called() assert.spy(fn).was_called_with(42) end) + + it("should apply value to function", function() + local agent = spy.new() + _.apply_to("007", agent) + assert.spy(agent).was_called(1) + assert.spy(agent).was_called_with "007" + end) + + it("should converge on function", function() + local target = spy.new() + _.converge(target, { _.head, _.last }, { "These", "Are", "Some", "Words", "Ain't", "That", "Pretty", "Nuts" }) + assert.spy(target).was_called(1) + assert.spy(target).was_called_with("These", "Nuts") + end) end) -- cgit v1.2.3-70-g09d2