()
| 23 | }) |
| 24 | |
| 25 | async function testGetDelKeys() { |
| 26 | let task1 = await bucket.schedule({ executeAt: new Date(Date.now() + 1000000), key: "1" }); |
| 27 | let task2 = await bucket.schedule({ executeAt: new Date(Date.now() + 1000000), key: "2" }); |
| 28 | let taskOtherNs = await anotherBucket.schedule({ executeAt: new Date(Date.now() + 1000000), key: "1" }); |
| 29 | let taskOtherPlugin = await bucketPluginCustom.schedule({ executeAt: new Date(Date.now() + 1000000), key: "1" }); |
| 30 | |
| 31 | assetJsonEquals(await Tasks.getById(task1.id), task1); |
| 32 | assetJsonEquals(await Tasks.getById(task2.id), task2); |
| 33 | assetJsonEquals(await Tasks.getById(taskOtherNs.id), taskOtherNs); |
| 34 | assetJsonEquals(await Tasks.getById(taskOtherPlugin.id), taskOtherPlugin); |
| 35 | |
| 36 | assetJsonEquals(await bucket.getByKey("1"), task1); |
| 37 | assetJsonEquals(await bucket.getByKey("2"), task2); |
| 38 | assetJsonEquals(await anotherBucket.getByKey("1"), taskOtherNs); |
| 39 | assetJsonEquals(await bucketPluginCustom.getByKey("1"), taskOtherPlugin); |
| 40 | |
| 41 | // test deleteAll while cleaning up |
| 42 | |
| 43 | // deleting the guild scoped bucket and ensuring it only deleted that |
| 44 | await bucket.deleteAll() |
| 45 | assertExpected(undefined, await bucket.getByKey("1")) |
| 46 | assertExpected(undefined, await bucket.getByKey("2")) |
| 47 | |
| 48 | assetJsonEquals(taskOtherNs, await anotherBucket.getByKey("1")); |
| 49 | assetJsonEquals(taskOtherPlugin, await bucketPluginCustom.getByKey("1")); |
| 50 | |
| 51 | // deleting plugin scoped bucket and ensuring it did not touch the guild one |
| 52 | await bucketPluginCustom.deleteAll() |
| 53 | assetJsonEquals(taskOtherNs, await anotherBucket.getByKey("1")); |
| 54 | assertExpected(undefined, await bucketPluginCustom.getByKey("1")); |
| 55 | |
| 56 | await anotherBucket.deleteAll() |
| 57 | assertExpected(undefined, await anotherBucket.getByKey("1")); |
| 58 | } |
| 59 | |
| 60 | async function testGetAll() { |
| 61 | for (let i = 0; i < 55; i++) { |
no test coverage detected