Skip to content

Commit 832258b

Browse files
Run yarn format
1 parent fd7c6c2 commit 832258b

File tree

5 files changed

+26
-12
lines changed

5 files changed

+26
-12
lines changed

packages/remote-config/src/api.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ import {
2323
Value
2424
} from './public_types';
2525
import { RemoteConfigAbortSignal } from './client/remote_config_fetch_client';
26-
import { RC_COMPONENT_NAME, RC_CUSTOM_SIGNAL_KEY_MAX_LENGTH, RC_CUSTOM_SIGNAL_VALUE_MAX_LENGTH } from './constants';
26+
import {
27+
RC_COMPONENT_NAME,
28+
RC_CUSTOM_SIGNAL_KEY_MAX_LENGTH,
29+
RC_CUSTOM_SIGNAL_VALUE_MAX_LENGTH
30+
} from './constants';
2731
import { ERROR_FACTORY, ErrorCode, hasErrorCode } from './errors';
2832
import { RemoteConfig as RemoteConfigImpl } from './remote_config';
2933
import { Value as ValueImpl } from './value';
@@ -285,7 +289,10 @@ export async function setCustomSignals(
285289
});
286290
}
287291
const value = customSignals[key];
288-
if (typeof value === 'string' && value.length > RC_CUSTOM_SIGNAL_VALUE_MAX_LENGTH) {
292+
if (
293+
typeof value === 'string' &&
294+
value.length > RC_CUSTOM_SIGNAL_VALUE_MAX_LENGTH
295+
) {
289296
throw ERROR_FACTORY.create(ErrorCode.CUSTOM_SIGNAL_VALUE_LENGTH, {
290297
key,
291298
maxLength: RC_CUSTOM_SIGNAL_VALUE_MAX_LENGTH

packages/remote-config/src/errors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ interface ErrorParams {
9696
[ErrorCode.FETCH_PARSE]: { originalErrorMessage: string };
9797
[ErrorCode.FETCH_STATUS]: { httpStatus: number };
9898
[ErrorCode.CUSTOM_SIGNAL_MAX_ALLOWED_SIGNALS]: { maxSignals: number };
99-
[ErrorCode.CUSTOM_SIGNAL_KEY_LENGTH]: { key: string, maxLength: number };
100-
[ErrorCode.CUSTOM_SIGNAL_VALUE_LENGTH]: { key: string, maxLength: number };
99+
[ErrorCode.CUSTOM_SIGNAL_KEY_LENGTH]: { key: string; maxLength: number };
100+
[ErrorCode.CUSTOM_SIGNAL_VALUE_LENGTH]: { key: string; maxLength: number };
101101
}
102102

103103
export const ERROR_FACTORY = new ErrorFactory<ErrorCode, ErrorParams>(

packages/remote-config/src/storage/storage.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ export class Storage {
204204
);
205205

206206
// Throw an error if the number of custom signals to be stored exceeds the limit
207-
if (Object.keys(signalsToUpdate).length > RC_CUSTOM_SIGNAL_MAX_ALLOWED_SIGNALS) {
207+
if (
208+
Object.keys(signalsToUpdate).length > RC_CUSTOM_SIGNAL_MAX_ALLOWED_SIGNALS
209+
) {
208210
throw ERROR_FACTORY.create(ErrorCode.CUSTOM_SIGNAL_MAX_ALLOWED_SIGNALS, {
209211
maxSignals: RC_CUSTOM_SIGNAL_MAX_ALLOWED_SIGNALS
210212
});

packages/remote-config/test/remote_config.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,25 @@ describe('RemoteConfig', () => {
107107
key: 'value'
108108
});
109109
});
110-
110+
111111
it('throws an error when supplied with a custom signal key greater than 250 characters', async () => {
112112
const longKey = 'a'.repeat(251);
113113
const customSignals = { [longKey]: 'value' };
114114

115-
await expect(setCustomSignals(rc, customSignals)).to.eventually.be.rejectedWith(
115+
await expect(
116+
setCustomSignals(rc, customSignals)
117+
).to.eventually.be.rejectedWith(
116118
`Remote Config: Custom signal key ${longKey} is too long, max allowed length is 250.`
117119
);
118120
});
119-
121+
120122
it('throws an error when supplied with a custom signal value greater than 500 characters', async () => {
121123
const longValue = 'a'.repeat(501);
122124
const customSignals = { 'key': longValue };
123125

124-
await expect(setCustomSignals(rc, customSignals)).to.eventually.be.rejectedWith(
126+
await expect(
127+
setCustomSignals(rc, customSignals)
128+
).to.eventually.be.rejectedWith(
125129
'Remote Config: Value supplied for custom signal key is too long, max allowed length is 500.'
126130
);
127131
});

packages/remote-config/test/storage/storage.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,12 @@ describe('Storage', () => {
158158
const customSignals: { [key: string]: string } = {};
159159
for (let i = 0; i < 101; i++) {
160160
customSignals[`key${i}`] = `value${i}`;
161-
}
161+
}
162162

163-
await expect(storage.setCustomSignals(customSignals)).to.eventually.be.rejectedWith(
163+
await expect(
164+
storage.setCustomSignals(customSignals)
165+
).to.eventually.be.rejectedWith(
164166
'Remote Config: Setting more than 100 custom signals is not supported.'
165167
);
166-
167168
});
168169
});

0 commit comments

Comments
 (0)