This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #1849 - exclude conversation.properties field from key generation
- Loading branch information
Showing
2 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
const assert = require('assert'); | ||
const { BotkitConversationState } = require('../lib/conversationState'); | ||
const { MemoryStorage } = require('botbuilder'); | ||
|
||
const storage = new MemoryStorage(); | ||
const state = new BotkitConversationState(storage); | ||
|
||
describe('BotkitConversationState', function() { | ||
it('should generate appropriate state key', function() { | ||
const key = state.getStorageKey({ | ||
activity: { | ||
channelId: 'test', | ||
from: { | ||
id: 'foo' | ||
}, | ||
conversation: { | ||
id: 'bar' | ||
} | ||
} | ||
}); | ||
assert(key === 'test/conversations/bar-foo/', 'failed key gen'); | ||
}); | ||
it('should generate appropriate state key excluding properties field', function() { | ||
const key = state.getStorageKey({ | ||
activity: { | ||
channelId: 'test', | ||
from: { | ||
id: 'foo' | ||
}, | ||
conversation: { | ||
properties: { | ||
baz: true | ||
}, | ||
id: 'bar' | ||
} | ||
} | ||
}); | ||
assert(key === 'test/conversations/bar-foo/', 'failed key gen'); | ||
}); | ||
it('should generate appropriate state key including platform field', function() { | ||
const key = state.getStorageKey({ | ||
activity: { | ||
channelId: 'test', | ||
from: { | ||
id: 'foo' | ||
}, | ||
conversation: { | ||
threadId: '5', | ||
channel: '9', | ||
id: 'bar' | ||
} | ||
} | ||
}); | ||
assert(key === 'test/conversations/9-bar-5-foo/', 'failed key gen'); | ||
}); | ||
}); |
f776ed5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for test coverage!