Skip to content

Instantly share code, notes, and snippets.

@csuwildcat
Created November 18, 2023 16:45
Show Gist options
  • Save csuwildcat/82315dd6630c6aad455c45371c38db21 to your computer and use it in GitHub Desktop.
Save csuwildcat/82315dd6630c6aad455c45371c38db21 to your computer and use it in GitHub Desktop.
$ npm run test:browser
> @web5/api@0.8.3 test:browser
> karma start karma.conf.cjs
Firefox 115.0 (Windows 10) WARN: 'failed to get tech preview dwn endpoints:', 'Network error'
18 11 2023 10:40:30.385:INFO [launcher]: Starting browser WebkitHeadless
18 11 2023 10:40:30.850:INFO [WebKit 605.1.15 (Windows 8)]: Connected on socket nFNGv_D5KWu4ABEUAAAF with id 17526702
WebKit 605.1.15 (Windows 8) LOG: 'STATUS CODE: 400 --> SchemaValidationFailure: /descriptor: must have required property 'schema''
DwnApi
protocols.configure()
agent
✔ writes a protocol definition
protocols.query()
agent
✔ should return protocols matching the query
from: did
✖ should return protocols matching the query
✖ returns empty protocols array when no protocols match the filter provided
✖ returns a 401 when authorization fails
records.create()
✔ creates a record with binary data and no schema
✖ should setup a protocol, check for it, and write a binary record with no schema
agent
✔ creates a record with string data
✔ creates a record with JSON data
agent store: false
✔ does not persist record to agent DWN
✔ has no effect if `store: true`
records.createFrom()
agent
✔ creates a new record that inherits properties from an existing record
records.delete()
agent
✖ deletes a record
✔ returns a 404 when the specified record does not exist
from: did
✖ deletes a record
✖ returns a 401 when authentication or authorization fails
records.query()
agent
✔ returns an array of records that match the filter provided
from: did
✖ returns an array of records that match the filter provided
✖ returns empty records array when no records match the filter provided
records.read()
agent
✔ returns a record
✔ returns a 404 when a record cannot be found
from: did
✖ returns a record
✖ returns undefined record when requested record does not exit
Record
✖ should retain all defined properties
data.blob()
✔ returns small data payloads after dwn.records.write()
✔ returns small data payloads after dwn.records.read()
✔ returns large data payloads after dwn.records.write()
✔ returns large data payloads after dwn.records.read()
data.json()
✔ returns small data payloads after dwn.records.write()
✔ returns small data payloads after dwn.records.read()
✔ returns large data payloads after dwn.records.write()
✔ returns large data payloads after dwn.records.read()
data.text()
✔ returns small data payloads after dwn.records.write()
✔ returns small data payloads after dwn.records.read()
✔ returns large data payloads after dwn.records.write()
✔ returns large data payloads after dwn.records.read()
delete()
✔ deletes the record
✔ throws an exception when delete is called twice
send()
✖ writes records to remote DWNs for your own DID
✖ writes records to remote DWNs for someone else's DID
with store: false
✖ writes records to your own remote DWN but not your agent DWN
✖ writes records to someone else's remote DWN but not your agent DWN
✖ has no effect if `store: true`
toJSON()
✖ should return all defined properties
update()
✔ updates a record
✔ throws an exception when an immutable property is modified
Protocol
send()
✖ configures protocols on remote DWNs for your own DID
toJSON()
✖ should return all defined properties (skipped)
DidApi
resolve()
✔ resolves a DID and returns a resolution result
✔ returns an invalidDid error if the DID cannot be parsed
✔ returns a methodNotSupported error if the DID method is not supported
WebKit 605.1.15 (Windows 8) WARN: 'failed to get tech preview dwn endpoints:', 'HTTP Error: 400 Bad Request'
WebKit 605.1.15 (Windows 8) WARN: 'failed to get tech preview dwn endpoints:', 'Network error'
Tech Preview
getTechPreviewDwnEndpoints()
✔ returns an array
✔ returns valid DWN endpoint URLs
✔ returns 2 DWN endpoints if at least 2 are healthy
✔ returns 1 DWN endpoints if only 1 is healthy
✔ ignores health check failures and tries next endpooint
✔ returns 0 DWN endpoints if none are healthy
✔ returns 0 DWN endpoints if dwn.tbddev.org is not responding
✔ returns 0 DWN endpoints if fetching dwn.tbddev.org throws an exception
VcApi
create()
✔ is not implemented
Web5 API Utils
dataToBlob()
✔ should handle text data with explicit format
✔ should handle text data with detected type
✔ should handle JSON data with explicit format
✔ should handle JSON data with detected type
✔ should handle Uint8Array data
✔ should handle ArrayBuffer data
✔ should handle Blob data
✔ should throw an error for unsupported data types
Web5
using TestManagedAgent
connect()
✔ accepts an externally created ION DID
constructor
✔ instantiates Web5 API with provided Web5Agent and connectedDid
connect()
✖ returns a web5 instance and connected DID using Web5UserAgent, by default
Finished in 1 min 36.804 secs / 1 min 3.453 secs @ 10:41:35 GMT-0600 (Central Standard Time)
SUMMARY:
✔ 152 tests completed
ℹ 3 tests skipped
✖ 58 tests failed
FAILED TESTS:
DwnApi
protocols.query()
from: did
✖ should return protocols matching the query
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
✖ returns empty protocols array when no protocols match the filter provided
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
✖ returns a 401 when authorization fails
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
records.create()
✖ should setup a protocol, check for it, and write a binary record with no schema
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
expected 400 to equal 202
mh@C:\repos\web5-js\node_modules\assertion-error\index.js:75:5 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:1:27866
@C:\repos\web5-js\node_modules\chai\lib\chai\assertion.js:152:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:3:16943
y@C:\repos\web5-js\node_modules\chai\lib\chai\core\assertions.js:1038:12 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:3:21637
i@C:\repos\web5-js\node_modules\chai\lib\chai\utils\addMethod.js:57:25 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:3:10646
@[native code]
T@C:\repos\web5-js\node_modules\chai-as-promised\lib\chai-as-promised.js:289:22 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:26:47001
s@C:\repos\web5-js\node_modules\chai\lib\chai\utils\overwriteMethod.js:78:33 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:3:11541
@[native code]
@C:\repos\web5-js\packages\api\tests\dwn-api.spec.ts:258:37 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:39:170796
records.delete()
agent
✖ deletes a record
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
from: did
✖ deletes a record
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
✖ returns a 401 when authentication or authorization fails
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
records.query()
from: did
✖ returns an array of records that match the filter provided
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
✖ returns empty records array when no records match the filter provided
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
records.read()
from: did
✖ returns a record
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
✖ returns undefined record when requested record does not exit
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
Record
✖ should retain all defined properties
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
RecordsWriteMissingSigner: This RecordsWrite is not yet signed, JSON message cannot be generated from an incomplete state.
Ve@C:\repos\web5-js\node_modules\@tbd54566975\dwn-sdk-js\src\core\dwn-error.ts:6:5 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:28:348476
message@C:\repos\web5-js\node_modules\@tbd54566975\dwn-sdk-js\src\interfaces\records-write.ts:150:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:28:782341
@C:\repos\web5-js\packages\api\tests\record.spec.ts:174:10 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:39:179085
send()
✖ writes records to remote DWNs for your own DID
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
✖ writes records to remote DWNs for someone else's DID
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
with store: false
✖ writes records to your own remote DWN but not your agent DWN
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
✖ writes records to someone else's remote DWN but not your agent DWN
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
✖ has no effect if `store: true`
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
toJSON()
✖ should return all defined properties
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
RecordsWriteMissingSigner: This RecordsWrite is not yet signed, JSON message cannot be generated from an incomplete state.
Ve@C:\repos\web5-js\node_modules\@tbd54566975\dwn-sdk-js\src\core\dwn-error.ts:6:5 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:28:348476
message@C:\repos\web5-js\node_modules\@tbd54566975\dwn-sdk-js\src\interfaces\records-write.ts:150:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:28:782341
@C:\repos\web5-js\packages\api\tests\record.spec.ts:936:12 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:39:191318
send()
✖ configures protocols on remote DWNs for your own DID
Chrome Headless 115.0.5790.75 (Windows 10)
Firefox 115.0 (Windows 10)
WebKit 605.1.15 (Windows 8)
[{"url":"http://localhost:3000","message":"JSON Parse error: Unexpected EOF"}]
@C:\repos\web5-js\packages\agent\src\dwn-manager.ts:233:17 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:19288
c@C:\repos\web5-js\packages\agent\src\utils.ts:190:1 <- C:\Users\DANIEL~1\AppData\Local\Temp\c382c485931e1c2d8f96df109563282d-bundle.js:29:16835
Web5
connect()
✖ returns a web5 instance and connected DID using Web5UserAgent, by default
WebKit 605.1.15 (Windows 8)
Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
npm ERR! Lifecycle script `test:browser` failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: @web5/api@0.8.3
npm ERR! at location: C:\repos\web5-js\packages\api
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment