Skip to content

Commit cc1dd80

Browse files
committed
chore: add chart test on agent factory
1 parent eef57ea commit cc1dd80

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/forest_admin_agent/spec/lib/forest_admin_agent/builder/agent_factory_spec.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,31 @@ module Builder
290290
end
291291
end
292292

293+
describe 'chart (DSL method)' do
294+
it 'provides a fluent DSL for creating charts' do
295+
instance = described_class.instance
296+
allow(instance.customizer).to receive(:add_chart)
297+
298+
result = instance.chart :appointments do
299+
value 784, 760
300+
end
301+
302+
expect(instance.customizer).to have_received(:add_chart).with('appointments')
303+
expect(result).to eq(instance)
304+
end
305+
306+
it 'converts symbol names to strings' do
307+
instance = described_class.instance
308+
allow(instance.customizer).to receive(:add_chart)
309+
310+
instance.chart :my_chart do
311+
value 123
312+
end
313+
314+
expect(instance.customizer).to have_received(:add_chart).with('my_chart')
315+
end
316+
end
317+
293318
describe 'format_schema_json' do
294319
it 'collapses single-element arrays onto one line' do
295320
instance = described_class.instance

0 commit comments

Comments
 (0)