Skip to content

Commit 44943e8

Browse files
updated ci/cd workflow. And added a missing assert in E2E test
1 parent 3761045 commit 44943e8

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

.github/workflows/ci-cd.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ jobs:
5050
- name: npm Build
5151
run: BUILD_BRANCH=$(echo "${GITHUB_REF#refs/heads/}") BUILD_COMMIT=${{ github.sha }} npm run build
5252

53-
- name: npm Build GaToSplit auto-require script
54-
run: npm run build:ga-to-split-autorequire
53+
# Uncomment to upload auto-require script to S3
54+
# - name: npm Build GaToSplit auto-require script
55+
# run: npm run build:ga-to-split-autorequire
5556

5657
- name: Configure AWS credentials (development)
5758
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }}

src/__tests__/browserSuites/push-synchronization.spec.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const MILLIS_UNLOAD_BROWSER_EVENT = 1700;
9494
* 1.7 secs: 'unload' browser event -> streaming connection closed
9595
*/
9696
export function testSynchronization(fetchMock, assert) {
97-
assert.plan(36);
97+
assert.plan(38);
9898
fetchMock.reset();
9999

100100
let start, splitio, client, otherClient, keylistAddClient, keylistRemoveClient, bitmapTrueClient, sharedClients = [];
@@ -135,11 +135,14 @@ export function testSynchronization(fetchMock, assert) {
135135

136136
setTimeout(() => {
137137
assert.equal(client.getTreatment('whitelist'), 'allowed', 'evaluation with not killed Split');
138-
client.once(client.Event.SDK_UPDATE, () => {
138+
const onUpdateCb = () => {
139139
const lapse = Date.now() - start;
140140
assert.true(nearlyEqual(lapse, MILLIS_SPLIT_KILL_EVENT), 'SDK_UPDATE due to SPLIT_KILL event');
141141
assert.equal(client.getTreatment('whitelist'), 'not_allowed', 'evaluation with killed Split');
142-
});
142+
};
143+
// SPLIT_KILL triggers two SDK_UPDATE events. The 1st due to `killLocally` and the 2nd due to `/splitChanges` fetch
144+
client.once(client.Event.SDK_UPDATE, onUpdateCb);
145+
client.once(client.Event.SDK_UPDATE, onUpdateCb);
143146
eventSourceInstance.emitMessage(splitKillMessage);
144147
}, MILLIS_SPLIT_KILL_EVENT); // send a SPLIT_KILL event with a new changeNumber after 0.5 seconds
145148

src/__tests__/nodeSuites/push-synchronization.spec.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const MILLIS_DESTROY = 700;
5757
* 0.6 secs: SPLIT_UPDATE event with new segments -> /splitChanges, /segmentChanges/{newSegments}
5858
*/
5959
export function testSynchronization(fetchMock, assert) {
60-
assert.plan(22);
60+
assert.plan(24);
6161
fetchMock.reset();
6262
__setEventSource(EventSourceMock);
6363

@@ -102,11 +102,14 @@ export function testSynchronization(fetchMock, assert) {
102102
}, MILLIS_SEGMENT_UPDATE_EVENT); // send a SEGMENT_UPDATE event with a new changeNumber after 0.4 seconds
103103
setTimeout(() => {
104104
assert.equal(client.getTreatment(key, 'whitelist'), 'allowed', 'evaluation with not killed Split');
105-
client.once(client.Event.SDK_UPDATE, () => {
105+
const onUpdateCb = () => {
106106
const lapse = Date.now() - start;
107107
assert.true(nearlyEqual(lapse, MILLIS_SPLIT_KILL_EVENT), 'SDK_UPDATE due to SPLIT_KILL event');
108108
assert.equal(client.getTreatment(key, 'whitelist'), 'not_allowed', 'evaluation with killed Split');
109-
});
109+
};
110+
// SPLIT_KILL triggers two SDK_UPDATE events. The 1st due to `killLocally` and the 2nd due to `/splitChanges` fetch
111+
client.once(client.Event.SDK_UPDATE, onUpdateCb);
112+
client.once(client.Event.SDK_UPDATE, onUpdateCb);
110113
eventSourceInstance.emitMessage(splitKillMessage);
111114
}, MILLIS_SPLIT_KILL_EVENT); // send a SPLIT_KILL event with a new changeNumber after 0.5 seconds
112115
setTimeout(() => {

0 commit comments

Comments
 (0)