Skip to content

Commit

Permalink
Merge pull request #371 from splitio/polishing
Browse files Browse the repository at this point in the history
General polishing
  • Loading branch information
EmilianoSanchez authored Dec 12, 2024
2 parents 92ed5ed + 3d9c4ec commit 55f289d
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/listeners/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class NodeSignalListener implements ISignalListener {
// Cleaned up, remove handlers.
this.stop();

// This handler prevented the default behaviour, start again.
// This handler prevented the default behavior, start again.
// eslint-disable-next-line no-undef
process.kill(process.pid, SIGTERM);
};
Expand All @@ -72,7 +72,7 @@ export class NodeSignalListener implements ISignalListener {
}

if (thenable(handlerResult)) {
// Always exit, even with errors. The promise is returned for UT purposses.
// Always exit, even with errors. The promise is returned for UT purposes.
return handlerResult.then(wrapUp).catch(wrapUp);
} else {
wrapUp();
Expand Down
8 changes: 4 additions & 4 deletions src/logger/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,22 @@ function testLogLevels(levelToTest: SplitIO.LogLevel) {

}

test('SPLIT LOGGER / Logger class public methods behaviour - instance.debug', () => {
test('SPLIT LOGGER / Logger class public methods behavior - instance.debug', () => {
testLogLevels(LogLevels.DEBUG);

});

test('SPLIT LOGGER / Logger class public methods behaviour - instance.info', () => {
test('SPLIT LOGGER / Logger class public methods behavior - instance.info', () => {
testLogLevels(LogLevels.INFO);

});

test('SPLIT LOGGER / Logger class public methods behaviour - instance.warn', () => {
test('SPLIT LOGGER / Logger class public methods behavior - instance.warn', () => {
testLogLevels(LogLevels.WARN);

});

test('SPLIT LOGGER / Logger class public methods behaviour - instance.error', () => {
test('SPLIT LOGGER / Logger class public methods behavior - instance.error', () => {
testLogLevels(LogLevels.ERROR);

});
Expand Down
2 changes: 2 additions & 0 deletions src/readiness/__tests__/readinessManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ test('READINESS MANAGER / Cancel timeout if ready fired', (done) => {

const readinessManager = readinessManagerFactory(EventEmitter, settingsWithTimeout);
readinessManager.init(); // Start the timeout
readinessManager.destroy(); // Should cancel the timeout
readinessManager.init(); // Start the timeout again

readinessManager.gate.on(SDK_READY_TIMED_OUT, () => { sdkReadyTimedoutCalled = true; });
readinessManager.gate.once(SDK_READY, () => { sdkReadyCalled = true; });
Expand Down
2 changes: 1 addition & 1 deletion src/readiness/__tests__/sdkReadinessManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ describe('SDK Readiness Manager - Event emitter', () => {

describe('SDK Readiness Manager - Ready promise', () => {

test('.ready() promise behaviour for clients', async () => {
test('.ready() promise behavior for clients', async () => {
const sdkReadinessManager = sdkReadinessManagerFactory(EventEmitterMock, fullSettings);

const ready = sdkReadinessManager.sdkStatus.ready();
Expand Down
2 changes: 1 addition & 1 deletion src/storages/inRedis/__tests__/RedisAdapter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('STORAGE Redis Adapter', () => {

expect(ioredisMock.once).toBeCalledTimes(2); // If the method was called, it should have called the `once` function twice. If that it the case we can assume that the method was called on creation.

// Reset stubs again, we'll check the behaviour calling the method directly.
// Reset stubs again, we'll check the behavior calling the method directly.
clearAllMocks();
expect(ioredisMock.once).not.toBeCalled(); // Control assertion
expect(ioredisMock[METHODS_TO_PROMISE_WRAP[METHODS_TO_PROMISE_WRAP.length - 1]]).not.toBeCalled(); // Control assertion
Expand Down
2 changes: 1 addition & 1 deletion src/trackers/eventTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function eventTrackerFactory(
whenInit(() => {
// Wrap in a timeout because we don't want it to be blocking.
setTimeout(() => {
// copy of event, to avoid unexpected behaviour if modified by integrations
// copy of event, to avoid unexpected behavior if modified by integrations
const eventDataCopy = objectAssign({}, eventData);
if (properties) eventDataCopy.properties = objectAssign({}, properties);
// integrationsManager does not throw errors (they are internally handled by each integration module)
Expand Down
2 changes: 1 addition & 1 deletion src/trackers/impressionsTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function impressionsTrackerFactory(
if (impressionListener || integrationsManager) {
for (let i = 0; i < impressionsToListenerCount; i++) {
const impressionData: SplitIO.ImpressionData = {
// copy of impression, to avoid unexpected behaviour if modified by integrations or impressionListener
// copy of impression, to avoid unexpected behavior if modified by integrations or impressionListener
impression: objectAssign({}, impressionsToListener[i]),
attributes,
ip,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/settingsValidation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export function settingsValidation(config: unknown, validationParams: ISettingsV
if (withDefaults.mode === LOCALHOST_MODE && maybeKey === undefined) {
withDefaults.core.key = 'localhost_key';
} else {
// Keeping same behaviour than JS SDK: if settings key or TT are invalid,
// Keeping same behavior than JS SDK: if settings key or TT are invalid,
// `false` value is used as bound key/TT of the default client, which leads to some issues.
// @ts-ignore, @TODO handle invalid keys as a non-recoverable error?
withDefaults.core.key = validateKey(log, maybeKey, LOG_PREFIX_CLIENT_INSTANTIATION);
Expand Down

0 comments on commit 55f289d

Please sign in to comment.