1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# frozen_string_literal: true
require 'yaml'
require_relative '../../../logic/cartridge/interaction'
RSpec.describe NanoBot::Logic::Cartridge::Interaction do
context 'input' do
let(:cartridge) { load_symbolized('cartridges/affixes.yml') }
it 'prepares the input' do
expect(described_class.input(cartridge, :repl, 'hello')).to eq(
{ content: 'hello', fennel: nil, lua: nil, clojure: nil, prefix: 'E', suffix: 'F' }
)
expect(described_class.input({}, :repl, 'hello')).to eq(
{ content: 'hello', fennel: nil, lua: nil, clojure: nil, prefix: nil, suffix: nil }
)
expect(described_class.input(cartridge, :eval, 'hello')).to eq(
{ content: 'hello', fennel: nil, lua: nil, clojure: nil, prefix: 'I', suffix: 'J' }
)
expect(described_class.input({}, :eval, 'hello')).to eq(
{ content: 'hello', fennel: nil, lua: nil, clojure: nil, prefix: nil, suffix: nil }
)
end
it 'prepares the non-streaming output' do
expect(described_class.output(cartridge, :repl, { message: 'hello' }, false, true)).to eq(
{ message: { content: 'hello', fennel: nil, lua: nil, clojure: nil } }
)
expect(described_class.output({}, :repl, { message: 'hello' }, false, true)).to eq(
{ message: { content: 'hello', fennel: nil, lua: nil, clojure: nil } }
)
expect(described_class.output(cartridge, :eval, { message: 'hello' }, false, true)).to eq(
{ message: { content: 'hello', fennel: nil, lua: nil, clojure: nil } }
)
expect(described_class.output({}, :eval, { message: 'hello' }, false, true)).to eq(
{ message: { content: 'hello', fennel: nil, lua: nil, clojure: nil } }
)
end
end
end
|