Test use cases for prop valueOf & toString

This commit is contained in:
Barney Carroll 2016-07-14 14:23:01 +01:00
parent 8f17472bcc
commit adaef70729

View file

@ -717,6 +717,19 @@ o.spec("stream", function() {
o(Stream.stream([1, 2, 3]).valueOf()).deepEquals([1, 2, 3])
o(Stream.stream().valueOf()).equals(undefined)
})
o("allows implicit value access in mathematical operations", function() {
o(Stream.stream(1) + Stream.stream(1)).equals(2)
})
})
o.spec("toString", function() {
o("aliases valueOf", function() {
var stream = Stream.stream(1)
o(stream.toString).equals(stream.valueOf)
})
o("allows implicit value access in string operations", function() {
o(Stream.stream("a") + Stream.stream("b")).equals("ab")
})
})
o.spec("toJSON", function() {
o("works", function() {