Skip to content

Commit 9d9e632

Browse files
author
Emmanuel Zamora
committed
Tests reading improvement, ci-cd update to push to development s3
1 parent 44e4af5 commit 9d9e632

File tree

3 files changed

+37
-39
lines changed

3 files changed

+37
-39
lines changed

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
aws-region: us-east-1
6363

6464
- name: Upload to S3 (development)
65-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }}
65+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/SDKS-5521-MTK' }}
6666
run: aws s3 sync $SOURCE_DIR s3://$BUCKET/$DEST_DIR $ARGS
6767
env:
6868
BUCKET: split-public-stage

src/__tests__/browserSuites/impressions.none.spec.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,20 @@ export default async function (fetchMock, assert) {
5555
fetchMock.postOnce(url(settings, '/v1/keys/cs'), (url, opts) => {
5656
const data = JSON.parse(opts.body);
5757

58-
assert.equal(data.keys.length, 2, 'We performed evaluations for three split, so we should have 3 item total.');
59-
60-
function validateImpressionData(output, expected) {
61-
assert.equal(output.k, expected.key, 'Present impressions should have the correct featureName.');
62-
assert.deepEqual(output.fs, expected.features, 'Present impressions should have the correct key list.');
63-
}
64-
65-
client.destroy().then(() => {
66-
validateImpressionData(data.keys[0], {
67-
key: 'facundo@split.io',
68-
features:['split_with_config','always_off', 'always_on']
69-
});
70-
validateImpressionData(data.keys[1], {
71-
key: 'emma@split.io',
72-
features:['always_off', 'always_on']
73-
});
74-
58+
assert.deepEqual(data, {
59+
keys: [
60+
{
61+
k: 'facundo@split.io',
62+
fs: ['split_with_config','always_off', 'always_on']
63+
},
64+
{
65+
k: 'emma@split.io',
66+
fs: ['always_off', 'always_on']
67+
}
68+
]
69+
}, 'We performed evaluations for two keys, so we should have 2 item total.');
70+
71+
client.destroy().then(() => {
7572
assert.end();
7673

7774
});
@@ -87,6 +84,9 @@ export default async function (fetchMock, assert) {
8784
sharedClient.getTreatment('always_off');
8885
client.getTreatment('always_off');
8986
sharedClient.getTreatment('always_on');
87+
sharedClient.getTreatment('always_off');
9088
client.getTreatment('always_on');
89+
client.getTreatment('always_off');
90+
client.getTreatment('split_with_config');
9191

9292
}

src/__tests__/nodeSuites/impressions.none.spec.js

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const config = {
2727
segmentsRefreshRate: 1,
2828
impressionsRefreshRate: 3000,
2929
impressionsQueueSize: 3, // flush impressions when 3 are queued
30-
uniqueKeysCacheSize: 7 // flush impressions when 3 are queued
30+
uniqueKeysCacheSize: 7 // flush impressions when 7 are queued
3131
},
3232
urls: baseUrls,
3333
startup: {
@@ -52,29 +52,25 @@ export default async function (key, fetchMock, assert) {
5252
fetchMock.postOnce(url(settings, '/v1/keys/ss'), (url, opts) => {
5353
const data = JSON.parse(opts.body);
5454

55-
assert.equal(data.keys.length, 3, 'We performed evaluations for three split, so we should have 3 item total.');
56-
57-
function validateImpressionData(output, expected) {
58-
assert.equal(output.f, expected.featureName, 'Present impressions should have the correct featureName.');
59-
assert.deepEqual(output.ks, expected.keys, 'Present impressions should have the correct key list.');
60-
}
55+
assert.deepEqual(data, {
56+
keys: [
57+
{
58+
f: 'split_with_config',
59+
ks:['emma@split.io','emi@split.io']
60+
},
61+
{
62+
f: 'always_off',
63+
ks:['emma@split.io','emi@split.io']
64+
},
65+
{
66+
f: 'always_on',
67+
ks:['emma@split.io','emi@split.io','nico@split.io']
68+
}
69+
]
70+
}, 'We performed evaluations for three split, so we should have 3 item total.');
6171

6272
client.destroy().then(() => {
63-
validateImpressionData(data.keys[0], {
64-
featureName: 'split_with_config',
65-
keys:['emma@split.io','emi@split.io']
66-
});
67-
validateImpressionData(data.keys[1], {
68-
featureName: 'always_off',
69-
keys:['emma@split.io','emi@split.io']
70-
});
71-
validateImpressionData(data.keys[2], {
72-
featureName: 'always_on',
73-
keys:['emma@split.io','emi@split.io','nico@split.io']
74-
});
75-
7673
assert.end();
77-
7874
});
7975

8076
return 200;
@@ -89,8 +85,10 @@ export default async function (key, fetchMock, assert) {
8985
client.getTreatment('emma@split.io', 'always_on');
9086
client.getTreatment('emi@split.io', 'always_on');
9187
client.getTreatment('nico@split.io', 'always_on');
88+
client.getTreatment('emma@split.io', 'always_off');
9289
client.getTreatment('emma@split.io', 'always_on');
9390
client.getTreatment('emi@split.io', 'always_off');
91+
client.getTreatment('nico@split.io', 'always_on');
9492
client.getTreatment('emi@split.io', 'split_with_config');
9593
client.getTreatment('emma@split.io', 'split_with_config');
9694

0 commit comments

Comments
 (0)