Hey, is there any official way to mock the Defender kvstore when running locally?
Thanks.
Hey, is there any official way to mock the Defender kvstore when running locally?
Thanks.
Not yet. What would work best for you…?
For testing purposes I find a disk-based local store sufficient, so you can try persistence across multiple runs, even from different autotasks.
Got it! Will work on it this week.
Hey @abarmat, check out the 1.10.0-local.0 release of the kvstore-client. It’s still not tagged as latest until it’s reviewed, but it may help in the meantime!
const { KeyValueStoreClient } = require('defender-kvstore-client');
async function local() {
// Creates an instance of the client that will write to a local file
const store = new KeyValueStoreClient({ path: '/tmp/foo/store.json' });
// The store.json file will contain { myKey: myValue }
await store.put('myKey', 'myValue');
}