mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-15 19:31:26 +00:00
Add specs that this.memory(key, falsy)
should work
This spots a bug in `getMemory()`.
This commit is contained in:
parent
e4e2782ebe
commit
4edb6e0866
1 changed files with 24 additions and 0 deletions
|
@ -186,6 +186,30 @@ describe Agents::JavaScriptAgent do
|
|||
@agent.save!
|
||||
expect { @agent.reload.memory }.not_to raise_error
|
||||
end
|
||||
|
||||
it "it stores null" do
|
||||
@agent.options['code'] = 'Agent.check = function() {
|
||||
this.memory("foo", "test");
|
||||
this.memory("foo", null);
|
||||
};'
|
||||
@agent.save!
|
||||
@agent.check
|
||||
expect(@agent.memory['foo']).to eq(nil)
|
||||
@agent.save!
|
||||
expect { @agent.reload.memory }.not_to raise_error
|
||||
end
|
||||
|
||||
it "it stores false" do
|
||||
@agent.options['code'] = 'Agent.check = function() {
|
||||
this.memory("foo", "test");
|
||||
this.memory("foo", false);
|
||||
};'
|
||||
@agent.save!
|
||||
@agent.check
|
||||
expect(@agent.memory['foo']).to eq(false)
|
||||
@agent.save!
|
||||
expect { @agent.reload.memory }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
describe "deleteKey" do
|
||||
|
|
Loading…
Add table
Reference in a new issue