Fork of github.com/did-method-plc/did-method-plc
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

add test for unsupported rotation keys, rewrite test for unsupported service keys to expect success (even though it currently fails), and add basic tests for syntactically invalid service keys

+28 -7
+28 -7
packages/server/tests/server.test.ts
··· 89 89 verifyDoc(doc) 90 90 }) 91 91 92 - it('does not allow key types that we do not support', async () => { 93 - // an ed25519 key which we don't yet support 92 + it('does not allow *rotation* key types that we do not yet support', async () => { 93 + // an ed25519 key, which we don't yet support 94 + const newRotationKey = 95 + 'did:key:z6MkjwbBXZnFqL8su24wGL2Fdjti6GSLv9SWdYGswfazUPm9' 96 + 97 + const promise = client.updateRotationKeys(did, rotationKey1, [ 98 + rotationKey1.did(), 99 + newRotationKey, 100 + ]) 101 + await expect(promise).rejects.toThrow(PlcClientError) 102 + }) 103 + 104 + it('allows *service* key types that we do not explicitly support', async () => { 105 + // an ed25519 key, which we don't explicitly support 94 106 const newSigningKey = 95 107 'did:key:z6MkjwbBXZnFqL8su24wGL2Fdjti6GSLv9SWdYGswfazUPm9' 96 108 97 - const promise = client.updateAtprotoKey(did, rotationKey1, newSigningKey) 109 + await client.updateAtprotoKey(did, rotationKey1, newSigningKey) 110 + }) 111 + 112 + it('does not allow syntactically invalid service keys', async () => { 113 + const promise = client.updateAtprotoKey( 114 + did, 115 + rotationKey1, 116 + 'did:banana', // a malformed did:key 117 + ) 98 118 await expect(promise).rejects.toThrow(PlcClientError) 99 - 100 - const promise2 = client.updateRotationKeys(did, rotationKey1, [ 101 - newSigningKey, 102 - ]) 119 + const promise2 = client.updateAtprotoKey( 120 + did, 121 + rotationKey1, 122 + 'blah', // an even more malformed did:key 123 + ) 103 124 await expect(promise2).rejects.toThrow(PlcClientError) 104 125 }) 105 126