-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alan Shaw
authored
Dec 11, 2022
1 parent
6dc77ca
commit a4f20a9
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import assert from 'assert' | ||
import { AgentData } from '../src/agent-data.js' | ||
|
||
describe('AgentData', () => { | ||
it('should not destructure store methods', async () => { | ||
// eslint-disable-next-line unicorn/no-await-expression-member | ||
const raw = (await AgentData.create()).export() | ||
class Store { | ||
async open() {} | ||
async close() {} | ||
async load() { | ||
return raw | ||
} | ||
|
||
async reset() {} | ||
async save() { | ||
if (!(this instanceof Store)) { | ||
throw new TypeError('unexpected this value') | ||
} | ||
} | ||
} | ||
const store = new Store() | ||
const data = await AgentData.create(undefined, { store }) | ||
await assert.doesNotReject(data.setCurrentSpace('did:x:y')) | ||
}) | ||
}) |