Skip to content

Commit 8b2c63a

Browse files
authored
Change condition return signature (#1809)
* Change condition return signature * Fix formatting
1 parent 15739bc commit 8b2c63a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

injected/integration-test/broker-protection-tests/broker-protection.spec.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ test.describe('Broker Protection communications', () => {
682682
expect(successResponse.actions.length).toBeGreaterThan(0);
683683
});
684684

685-
test('a condition with failSilently returns success with empty response', async ({ page }, workerInfo) => {
685+
test('a condition with failSilently returns success with empty actions array', async ({ page }, workerInfo) => {
686686
const dbp = BrokerProtectionPage.create(page, workerInfo.project.use);
687687
await dbp.enabled();
688688
await dbp.navigatesTo('form.html');
@@ -692,7 +692,10 @@ test.describe('Broker Protection communications', () => {
692692

693693
// Check that the response does not contain an actions array
694694
const successResponse = await dbp.getSuccessResponse();
695-
expect(successResponse).toBeNull();
695+
696+
expect(successResponse).toHaveProperty('actions');
697+
expect(Array.isArray(successResponse.actions)).toBe(true);
698+
expect(successResponse.actions.length).toBe(0);
696699
});
697700

698701
test('a failing condition returns error', async ({ page }, workerInfo) => {

injected/src/features/broker-protection/actions/condition.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ export function condition(action, root = document) {
3535
});
3636
}
3737

38-
return new SuccessResponse({ actionID: action.id, actionType: action.actionType, response: null });
38+
return new SuccessResponse({ actionID: action.id, actionType: action.actionType, response: { actions: [] } });
3939
}

0 commit comments

Comments
 (0)