Skip to content

Commit e8ebe07

Browse files
committed
Better filtering
1 parent 0bf094e commit e8ebe07

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

__tests__/setup/conditions/actionDispatched.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
import { Condition } from 'selenium-webdriver';
22

33
export default function actionDispatched(predicateOrType) {
4+
const message =
5+
typeof predicateOrType === 'string' ? `action "${predicateOrType}" to dispatch` : 'action to dispatch';
6+
47
if (typeof predicateOrType === 'string') {
58
const expectedType = predicateOrType;
69

710
predicateOrType = ({ type }) => type === expectedType;
811
}
912

10-
return new Condition('Action to dispatch', async driver => {
13+
return new Condition(message, async driver => {
1114
const actions = await driver.executeScript(() =>
1215
JSON.parse(
1316
JSON.stringify(
1417
window.WebChatTest.actions.map(action => {
15-
// Filter out payload on DIRECT_LINE/CONNECT* because the content is not stringifiable
18+
// Filter out payload on DIRECT_LINE/* because some content is not stringifiable
1619

17-
if (/^DIRECT_LINE\/CONNECT/.test(action.type) && action.payload && action.payload.directLine) {
18-
action.payload.directLine = {};
20+
if (/^DIRECT_LINE\//.test(action.type) && action.payload && action.payload.directLine) {
21+
return simpleUpdateIn(action, ['payload', 'directLine'], () => ({}));
1922
}
2023

2124
return action;

__tests__/setup/web/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
</style>
5050
<script src="https://tdurnford.github.io/BotFramework-Offline-MockBot/index.js"></script>
5151
<script src="https://unpkg.com/[email protected]/dist/event-target-shim.umd.js"></script>
52+
<script src="https://unpkg.com/simple-update-in"></script>
5253
<script src="/createProduceConsumeBroker.js"></script>
5354
<script src="/mockWebSpeech.js"></script>
5455
</head>

0 commit comments

Comments
 (0)