forwarder
Version:
Forwarding of messages to different objects (mostly properties of the receiver)
22 lines (17 loc) • 491 B
text/coffeescript
{ expect } = require "chai"
{ forward } = require "../src/forwarder"
describe "forwarder", ->
obj =
content:
a: 42
b: 43
it "applies [] to hashes if they are targets (with currying)", ->
forward obj, "a", to: "content", as: "[]", with: "a"
expect(
obj.a()
).to.equal 42
it "applies to hashes if they are targets (with params provided @ runtime)", ->
forward obj, "get", to: "content", as: "[]"
expect(
obj.get('b')
).to.equal 43