MCPcopy Create free account
hub / github.com/Botloader/botloader / testGetAll

Function testGetAll

integration-tests/tasks_get_del_bucket.ts:60–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

58}
59
60async function testGetAll() {
61 for (let i = 0; i < 55; i++) {
62 await bucket.schedule({ executeAt: new Date(Date.now() + 1000000), key: "" + i });
63 await anotherBucket.schedule({ executeAt: new Date(Date.now() + 1000000), key: "100" + i });
64 await bucketPluginCustom.schedule({ executeAt: new Date(Date.now() + 1000000), key: "10000" + i });
65 }
66
67 const inNamespace = await countAll(bucket);
68 assertExpected(55, inNamespace)
69
70 const inPlugin = await countAll(bucketPluginCustom);
71 assertExpected(55, inPlugin)
72
73 const all = await countAll();
74 // other scripts are running, so we we have no idea how many there is overall, but it should be atleast 200
75 if (all < 110) {
76 throw new Error(`${inNamespace} < 110`)
77 }
78
79 await bucket.deleteAll()
80 await anotherBucket.deleteAll()
81 await bucketPluginCustom.deleteAll()
82}
83
84async function countAll(bucket?: Tasks.TaskBucket): Promise<number> {
85 let last = 0;

Callers 1

Calls 4

assertExpectedFunction · 0.90
scheduleMethod · 0.80
deleteAllMethod · 0.80
countAllFunction · 0.70

Tested by

no test coverage detected