mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add a test case for context/index
This commit is contained in:
parent
c4eae3f130
commit
23b887c30e
@ -221,6 +221,13 @@ describe('context', function() {
|
||||
config:{}
|
||||
}
|
||||
};
|
||||
var contextAlias={
|
||||
default: "test",
|
||||
test:{
|
||||
module: testPlugin,
|
||||
config:{}
|
||||
}
|
||||
};
|
||||
|
||||
afterEach(function() {
|
||||
sandbox.reset();
|
||||
@ -421,6 +428,21 @@ describe('context', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
it('should use default as the alias of other context', function() {
|
||||
Context.init({contextStorage:contextAlias});
|
||||
return Context.load().then(function(){
|
||||
var context = Context.get("1","flow");
|
||||
return when.all([
|
||||
context.setAsync("#.foo","alias"),
|
||||
context.getAsync("#.foo"),
|
||||
context.keysAsync("#")
|
||||
]).then(function(){
|
||||
stubSetAsync.calledWithExactly("1:flow","foo","alias").should.be.true();
|
||||
stubGetAsync.calledWithExactly("1:flow","foo").should.be.true();
|
||||
stubKeysAsync.calledWithExactly("1:flow").should.be.true();
|
||||
});
|
||||
});
|
||||
});
|
||||
it('should throw an error using undefined storage for local context', function(done) {
|
||||
Context.init({contextStorage:contextStorage});
|
||||
Context.load().then(function(){
|
||||
|
Loading…
Reference in New Issue
Block a user