mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Prevent for-each calls
This commit is contained in:
@@ -198,7 +198,9 @@ describeIf('docker')('A server with a RedisLocker', (): void => {
|
||||
countdown -= 1;
|
||||
// Start releasing locks after 3 inits of the promises below
|
||||
if (countdown === 0) {
|
||||
[ 1, 0, 2 ].forEach((num): unknown => releaseSignal.emit(`release${num}`));
|
||||
for (const num of [ 1, 0, 2 ]) {
|
||||
releaseSignal.emit(`release${num}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
const promises = [ 0, 1, 2 ].map(async(num): Promise<any> =>
|
||||
|
||||
@@ -70,6 +70,7 @@ describe('A HashMap', (): void => {
|
||||
|
||||
it('supports a forEach call.', async(): Promise<void> => {
|
||||
const result: string[] = [];
|
||||
// eslint-disable-next-line unicorn/no-array-for-each
|
||||
map.forEach((value): void => {
|
||||
result.push(value.field3);
|
||||
});
|
||||
|
||||
@@ -156,6 +156,7 @@ describe('A WrappedSetMultiMap', (): void => {
|
||||
it('supports a forEach call.', async(): Promise<void> => {
|
||||
expect(map.set(key, new Set([ 123, 456 ]))).toBe(map);
|
||||
const result: number[] = [];
|
||||
// eslint-disable-next-line unicorn/no-array-for-each
|
||||
map.forEach((value): void => {
|
||||
result.push(value);
|
||||
});
|
||||
|
||||
@@ -146,7 +146,7 @@ export function mockFileSystem(rootFilepath?: string, time?: Date): { data: any
|
||||
const name = parts.at(-1) as string;
|
||||
parts = parts.slice(0, -1);
|
||||
let folder = cache.data;
|
||||
parts.forEach((part): any => {
|
||||
for (const part of parts) {
|
||||
if (typeof folder === 'string') {
|
||||
throwSystemError('ENOTDIR');
|
||||
}
|
||||
@@ -154,7 +154,7 @@ export function mockFileSystem(rootFilepath?: string, time?: Date): { data: any
|
||||
if (!folder) {
|
||||
throwSystemError('ENOENT');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return { folder, name };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user