|
52 | 52 | end |
53 | 53 |
|
54 | 54 | context "with MaxInputBytesPerBatch" do |
55 | | - let(:payload) { {"MaxInputBytesPerBatch" => 1_024} } |
| 55 | + let(:payload) { {"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => 1_024} } |
56 | 56 |
|
57 | 57 | it "returns an ItemBatcher" do |
58 | | - pending "implement MaxInputBytesPerBatch" |
59 | 58 | expect(subject).to be_kind_of(described_class) |
60 | 59 | end |
61 | 60 |
|
62 | 61 | it "sets max_input_bytes_per_batch" do |
63 | | - pending "implement MaxInputBytesPerBatch" |
64 | | - |
65 | 62 | expect(subject.max_input_bytes_per_batch).to eq(payload["MaxInputBytesPerBatch"]) |
66 | 63 | end |
67 | 64 |
|
68 | 65 | context "that is an invalid value" do |
69 | 66 | it "raises an exception" do |
70 | | - pending "implement MaxInputBytesPerBatch" |
71 | | - |
72 | | - expect { described_class.new({"MaxInputBytesPerBatch" => 0}, ["Map", "ItemBatcher"]) } |
| 67 | + expect { described_class.new({"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => 0}, ["Map", "ItemBatcher"]) } |
73 | 68 | .to raise_error(Floe::InvalidWorkflowError, "Map.ItemBatcher field \"MaxInputBytesPerBatch\" value \"0\" must be a positive integer") |
74 | | - expect { described_class.new({"MaxInputBytesPerBatch" => -1}, ["Map", "ItemBatcher"]) } |
| 69 | + expect { described_class.new({"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => -1}, ["Map", "ItemBatcher"]) } |
75 | 70 | .to raise_error(Floe::InvalidWorkflowError, "Map.ItemBatcher field \"MaxInputBytesPerBatch\" value \"-1\" must be a positive integer") |
76 | | - expect { described_class.new({"MaxInputBytesPerBatch" => 2.5}, ["Map", "ItemBatcher"]) } |
| 71 | + expect { described_class.new({"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => 2.5}, ["Map", "ItemBatcher"]) } |
77 | 72 | .to raise_error(Floe::InvalidWorkflowError, "Map.ItemBatcher field \"MaxInputBytesPerBatch\" value \"2.5\" must be a positive integer") |
78 | | - expect { described_class.new({"MaxInputBytesPerBatch" => "1"}, ["Map", "ItemBatcher"]) } |
| 73 | + expect { described_class.new({"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => "1"}, ["Map", "ItemBatcher"]) } |
79 | 74 | .to raise_error(Floe::InvalidWorkflowError, "Map.ItemBatcher field \"MaxInputBytesPerBatch\" value \"1\" must be a positive integer") |
80 | 75 | end |
81 | 76 | end |
|
95 | 90 | end |
96 | 91 |
|
97 | 92 | context "with MaxInputBytesPerBatchPath" do |
98 | | - let(:payload) { {"MaxInputBytesPerBatchPath" => "$.batchSize"} } |
| 93 | + let(:payload) { {"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatchPath" => "$.batchSize"} } |
99 | 94 |
|
100 | 95 | it "returns an ItemBatcher" do |
101 | | - pending "implement MaxInputBytesPerBatchPath" |
102 | | - |
103 | 96 | expect(subject).to be_kind_of(described_class) |
104 | 97 | end |
105 | 98 |
|
106 | 99 | it "sets max_input_bytes_per_batch_path" do |
107 | | - pending "implement MaxInputBytesPerBatchPath" |
108 | | - |
109 | 100 | expect(subject.max_input_bytes_per_batch_path).to be_kind_of(Floe::Workflow::ReferencePath) |
110 | 101 | expect(subject.max_input_bytes_per_batch_path).to have_attributes(:path => ["batchSize"]) |
111 | 102 | end |
|
120 | 111 | end |
121 | 112 |
|
122 | 113 | context "with MaxInputBytesPerBatch and MaxInputBytesPerBatchPath" do |
123 | | - let(:payload) { {"MaxInputBytesPerBatch" => 1_024, "MaxInputBytesPerBatchPath" => "$.batchSize"} } |
| 114 | + let(:payload) { {"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => 1_024, "MaxInputBytesPerBatchPath" => "$.batchSize"} } |
124 | 115 |
|
125 | 116 | it "raises an exception" do |
126 | | - pending "implement MaxInputBytesPerBatchPath" |
127 | | - |
128 | 117 | expect { subject }.to raise_error(Floe::InvalidWorkflowError, "Map.ItemBatcher must not specify both \"MaxInputBytesPerBatch\" and \"MaxInputBytesPerBatchPath\"") |
129 | 118 | end |
130 | 119 | end |
|
165 | 154 | end |
166 | 155 |
|
167 | 156 | context "with MaxInputBytesPerBatch" do |
168 | | - let(:payload) { {"MaxInputBytesPerBatch" => 1_024} } |
| 157 | + let(:payload) { {"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => 1_024} } |
169 | 158 |
|
170 | 159 | it "returns in batches of 2" do |
171 | 160 | pending "support max bytes per batch" |
|
175 | 164 | end |
176 | 165 |
|
177 | 166 | context "with MaxInputBytesPerBatchPath" do |
178 | | - let(:payload) { {"MaxInputBytesPerBatchPath" => "$.bytesPerBatch"} } |
| 167 | + let(:payload) { {"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatchPath" => "$.bytesPerBatch"} } |
179 | 168 | let(:state_input) { {"bytesPerBatch" => 1_024, "items" => input} } |
180 | 169 |
|
181 | 170 | it "returns in batches of 2" do |
|
185 | 174 | end |
186 | 175 |
|
187 | 176 | context "with an invalid value in input" do |
188 | | - let(:state_input) { {"bytesPerBatch" => 0, "items" => input} } |
| 177 | + let(:state_input) { {"MaxItemsPerBatch" => 10, "bytesPerBatch" => 0, "items" => input} } |
189 | 178 |
|
190 | 179 | it "raises an exception" do |
191 | 180 | pending "support max bytes per batch" |
|
0 commit comments