diff options
| author | William Boman <william@redwill.se> | 2022-12-08 02:06:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-08 01:06:23 +0000 |
| commit | 9394bcc5c582e737f0ff6bba1e411f97ee9c8c5d (patch) | |
| tree | 9729e9a1dfc493dbc7a0b2a4dfb359856c9de192 /tests/mason-core/functional/function_spec.lua | |
| parent | feat(functional): add more functions (#741) (diff) | |
| download | mason-9394bcc5c582e737f0ff6bba1e411f97ee9c8c5d.tar mason-9394bcc5c582e737f0ff6bba1e411f97ee9c8c5d.tar.gz mason-9394bcc5c582e737f0ff6bba1e411f97ee9c8c5d.tar.bz2 mason-9394bcc5c582e737f0ff6bba1e411f97ee9c8c5d.tar.lz mason-9394bcc5c582e737f0ff6bba1e411f97ee9c8c5d.tar.xz mason-9394bcc5c582e737f0ff6bba1e411f97ee9c8c5d.tar.zst mason-9394bcc5c582e737f0ff6bba1e411f97ee9c8c5d.zip | |
test(functional): add some tests (#742)
Forgot to include these in the last commit.
Diffstat (limited to 'tests/mason-core/functional/function_spec.lua')
| -rw-r--r-- | tests/mason-core/functional/function_spec.lua | 14 |
1 files changed, 14 insertions, 0 deletions
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) |
