Sha256: 6e04d577da1b90e2036062cddc2192712ff051c6478dbdf32066c812c1a2f1dc

Contents?: true

Size: 390 Bytes

Versions: 1

Compression:

Stored size: 390 Bytes

Contents

require 'spec_helper'
require 'dentaku/ast/functions/map'
require 'dentaku'

describe Dentaku::AST::Map do
  it 'operates on each value in an array' do
    result = Dentaku('SUM(MAP(vals, val, val + 1))', vals: [1, 2, 3])
    expect(result).to eq(9)
  end

  it 'works with an empty array' do
    result = Dentaku('MAP(vals, val, val + 1)', vals: [])
    expect(result).to eq([])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dentaku-3.4.2 spec/ast/map_spec.rb