mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-14 03:19:28 +02:00
[Test] Add iterate, fix each method in mock container (#5882)
This commit is contained in:
parent
d5789105f3
commit
d8c00616fc
@ -272,9 +272,24 @@ export default class MockContainer implements MockGameObject {
|
||||
return this;
|
||||
}
|
||||
|
||||
each(method): this {
|
||||
// biome-ignore lint/complexity/noBannedTypes: This matches the signature of the method it mocks
|
||||
each(callback: Function, context?: object, ...args: any[]): this {
|
||||
if (context !== undefined) {
|
||||
callback = callback.bind(context);
|
||||
}
|
||||
for (const item of this.list.slice()) {
|
||||
callback(item, ...args);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
// biome-ignore lint/complexity/noBannedTypes: This matches the signature of the method it mocks
|
||||
iterate(callback: Function, context?: object, ...args: any[]): this {
|
||||
if (context !== undefined) {
|
||||
callback = callback.bind(context);
|
||||
}
|
||||
for (const item of this.list) {
|
||||
method(item);
|
||||
callback(item, ...args);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user