Skip to content

Commit 349c551

Browse files
fix linting
Signed-off-by: Thomas Poignant <[email protected]>
1 parent 622f245 commit 349c551

File tree

1 file changed

+27
-47
lines changed

1 file changed

+27
-47
lines changed

libs/providers/go-feature-flag/src/lib/go-feature-flag-provider.spec.ts

Lines changed: 27 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,11 @@ describe('GoFeatureFlagProvider', () => {
872872
flagCacheTTL: 3000,
873873
flagCacheSize: 100,
874874
dataFlushInterval: 1000, // in milliseconds
875+
exporterMetadata: {
876+
nodeJSVersion: '14.17.0',
877+
appVersion: '1.0.0',
878+
identifier: 123,
879+
},
875880
});
876881
const providerName = expect.getState().currentTestName || 'test';
877882
await OpenFeature.setProviderAndWait(providerName, goff);
@@ -896,9 +901,9 @@ describe('GoFeatureFlagProvider', () => {
896901
userKey: 'user-key',
897902
},
898903
],
899-
meta: { provider: 'open-feature-js-sdk' },
904+
meta: { provider: 'js', openfeature: true, nodeJSVersion: '14.17.0', appVersion: '1.0.0', identifier: 123 },
900905
};
901-
expect(want).toEqual(got);
906+
expect(got).toEqual(want);
902907
});
903908

904909
it('should call the data collector when waiting more than the dataFlushInterval', async () => {
@@ -912,6 +917,11 @@ describe('GoFeatureFlagProvider', () => {
912917
flagCacheTTL: 3000,
913918
flagCacheSize: 100,
914919
dataFlushInterval: 100, // in milliseconds
920+
exporterMetadata: {
921+
nodeJSVersion: '14.17.0',
922+
appVersion: '1.0.0',
923+
identifier: 123,
924+
},
915925
});
916926
const providerName = expect.getState().currentTestName || 'test';
917927
await OpenFeature.setProviderAndWait(providerName, goff);
@@ -934,6 +944,11 @@ describe('GoFeatureFlagProvider', () => {
934944
flagCacheTTL: 3000,
935945
flagCacheSize: 100,
936946
dataFlushInterval: 100, // in milliseconds
947+
exporterMetadata: {
948+
nodeJSVersion: '14.17.0',
949+
appVersion: '1.0.0',
950+
identifier: 123,
951+
},
937952
});
938953
const providerName = expect.getState().currentTestName || 'test';
939954
await OpenFeature.setProviderAndWait(providerName, goff);
@@ -962,6 +977,11 @@ describe('GoFeatureFlagProvider', () => {
962977
flagCacheTTL: 3000,
963978
flagCacheSize: 100,
964979
dataFlushInterval: 200, // in milliseconds
980+
exporterMetadata: {
981+
nodeJSVersion: '14.17.0',
982+
appVersion: '1.0.0',
983+
identifier: 123,
984+
},
965985
});
966986
const providerName = expect.getState().currentTestName || 'test';
967987
await OpenFeature.setProviderAndWait(providerName, goff);
@@ -988,6 +1008,11 @@ describe('GoFeatureFlagProvider', () => {
9881008
flagCacheTTL: 3000,
9891009
flagCacheSize: 100,
9901010
dataFlushInterval: 2000, // in milliseconds
1011+
exporterMetadata: {
1012+
nodeJSVersion: '14.17.0',
1013+
appVersion: '1.0.0',
1014+
identifier: 123,
1015+
},
9911016
},
9921017
testLogger,
9931018
);
@@ -1003,51 +1028,6 @@ describe('GoFeatureFlagProvider', () => {
10031028
'Error: impossible to send the data to the collector: Error: Request failed with status code 500',
10041029
);
10051030
});
1006-
1007-
it('should call the data collector with exporter metadata', async () => {
1008-
const flagName = 'random-flag';
1009-
const targetingKey = 'user-key';
1010-
const dns = `${endpoint}v1/feature/${flagName}/eval`;
1011-
1012-
axiosMock.onPost(dns).reply(200, validBoolResponse);
1013-
const goff = new GoFeatureFlagProvider({
1014-
endpoint,
1015-
flagCacheTTL: 3000,
1016-
flagCacheSize: 100,
1017-
dataFlushInterval: 1000, // in milliseconds
1018-
exporterMetadata: {
1019-
nodeJSVersion: '14.17.0',
1020-
appVersion: '1.0.0',
1021-
identifier: 123,
1022-
},
1023-
});
1024-
const providerName = expect.getState().currentTestName || 'test';
1025-
await OpenFeature.setProviderAndWait(providerName, goff);
1026-
const cli = OpenFeature.getClient(providerName);
1027-
await cli.getBooleanDetails(flagName, false, { targetingKey });
1028-
await cli.getBooleanDetails(flagName, false, { targetingKey });
1029-
await OpenFeature.close();
1030-
const collectorCalls = axiosMock.history['post'].filter((i) => i.url === dataCollectorEndpoint);
1031-
expect(collectorCalls.length).toBe(1);
1032-
const got = JSON.parse(collectorCalls[0].data);
1033-
expect(isNaN(got.events[0].creationDate)).toBe(false);
1034-
const want = {
1035-
events: [
1036-
{
1037-
contextKind: 'user',
1038-
kind: 'feature',
1039-
creationDate: got.events[0].creationDate,
1040-
default: false,
1041-
key: 'random-flag',
1042-
value: true,
1043-
variation: 'trueVariation',
1044-
userKey: 'user-key',
1045-
},
1046-
],
1047-
meta: { provider: 'js', openfeature: true, nodeJSVersion: '14.17.0', appVersion: '1.0.0', identifier: 123 },
1048-
};
1049-
expect(want).toEqual(got);
1050-
});
10511031
});
10521032
describe('polling', () => {
10531033
it('should_stop_calling_flag_change_if_receive_404', async () => {

0 commit comments

Comments
 (0)