mirror of
https://github.com/hanzoai/Detox.git
synced 2026-09-24 16:55:12 +00:00
23 lines
424 B
JavaScript
23 lines
424 B
JavaScript
const { sleepSomeTime, sleepALittle } = require('./stubSleeps');
|
|
|
|
class StubDeviceAllocationDriver {
|
|
counter = 0;
|
|
|
|
async allocate() {
|
|
const deviceId = `StubDevice#${++this.counter}`;
|
|
|
|
await sleepSomeTime();
|
|
return { id: deviceId };
|
|
}
|
|
|
|
async free(cookie, { shutdown }) {
|
|
await sleepALittle();
|
|
|
|
if (shutdown) {
|
|
await sleepSomeTime();
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = StubDeviceAllocationDriver;
|