-
Notifications
You must be signed in to change notification settings - Fork 39
Chat proof #544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Chat proof #544
Changes from 5 commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
ab0899b
initial
bourgeoa d84ea71
some lint
bourgeoa ec9e90b
updates
bourgeoa 490a364
getBlankMsg
bourgeoa 1911313
getPrivateKey
bourgeoa 1d8b733
key exists
bourgeoa 6df03c8
add first test
bourgeoa 109c494
resolve typescript issues
bourgeoa 2da93f8
tests generate keys with node crypto in setup
bourgeoa 6c8461c
keys.test.ts
bourgeoa 94b70b5
signature.test.ts
bourgeoa c5b2fb8
updates
bourgeoa 20175fe
update package-lock.json
bourgeoa a5809dd
missing awaits
bourgeoa 9f7a01d
package-lock.json
bourgeoa cd2500d
separated helpers for testing
SharonStrats 5975073
updates message.js
bourgeoa 8ec0833
refactored to smaller parts
SharonStrats 9c84c1e
create keys and improvements
bourgeoa 96e84cf
package-lock.json
bourgeoa 2166356
update keyUrl with space:storage
bourgeoa eed9bea
add key container ACL
bourgeoa 3652e5c
update setAcl key container
bourgeoa c239a13
trying to mock store fetcher load function
SharonStrats 0ba702c
Update src/chat/keys.ts
bourgeoa ef25bb1
adding testing to docs
SharonStrats 098e8a7
Merge branch 'chat-proof' of https://github.com/SolidOS/solid-ui into…
SharonStrats 89f16fa
update get podRoot, use NamedNode
bourgeoa 67289c6
Merge branch 'chat-proof' of https://github.com/solidos/solid-ui into…
bourgeoa 8eed263
skip failing keys.test.ts
bourgeoa 11c883a
mocked load
SharonStrats beea007
Merge branch 'chat-proof' of https://github.com/SolidOS/solid-ui into…
SharonStrats 282702e
more cleaning
bourgeoa 17005e6
Merge branch 'chat-proof' of https://github.com/solidos/solid-ui into…
bourgeoa 0202734
more NamedNode
bourgeoa a6ef582
some cleaning
bourgeoa a573676
refactored function names
SharonStrats 4370b23
added tests
SharonStrats 0493bdd
Merge branch 'chat-proof' of https://github.com/SolidOS/solid-ui into…
SharonStrats 69ecfab
created a keyhelper dir
SharonStrats 18070a0
split files up for easier testing
SharonStrats aa51d1d
readmes for testing
SharonStrats 830468e
key file tests
SharonStrats 50ca84d
keys testing
SharonStrats a1b9ed4
updated testing readme
SharonStrats 70090f2
added tests
SharonStrats 27b35f4
acl refactor and tests
SharonStrats d02c4c2
key tests
SharonStrats f7310cd
fixed broken test
SharonStrats 85020be
access data test
SharonStrats 12e3adb
Update test/unit/README.md
SharonStrats 3f1ead6
Update test/unit/README.md
SharonStrats 90c87cc
Update test/unit/README.md
SharonStrats 47a7934
Update test/unit/README.md
SharonStrats 4bbe4cc
Update test/unit/README.md
SharonStrats 0a40d64
Update test/unit/README.md
SharonStrats ea3f761
Update test/unit/README.md
SharonStrats 15b7da3
rename deleteKey to deleteKeyAcl
bourgeoa 7506217
getPodRoot returns NamedNode
bourgeoa 998e1dd
move privateKey to /settings/keys/privateKey.ttl
bourgeoa cb30461
replace pop with slice
bourgeoa 3576458
Update test/unit/README.md
SharonStrats d527997
testing
SharonStrats 0829883
Merge branch 'chat-proof' of https://github.com/SolidOS/solid-ui into…
SharonStrats 2da9b5c
remove testing debug msg
SharonStrats 9ee704c
fix lint error
SharonStrats 3d362e6
restore PUT on 404
bourgeoa 027eefb
use solid ontology
bourgeoa 840c347
removed commented out code
SharonStrats File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,10 +1,40 @@ | ||||||||||||||
| # Solid-UI Unit Testing | ||||||||||||||
| The purpose of this README is to provide guidance on how to write tests for solid-ui for beginners. | ||||||||||||||
|
|
||||||||||||||
| Although we would love to have 100% test coverage, we realize that this is not a commericial product. solid-ui is an open source, volunteer built library that houses UI components that can be used to build Solid applications. We are working to increase test coverage on existing code, any help is much appreciated. If you add a new component to solid-ui, you should write tests to test the main functionality of your component in order for your PR to be merged. | ||||||||||||||
|
|
||||||||||||||
| ## Running Tests | ||||||||||||||
|
|
||||||||||||||
| ### All | ||||||||||||||
| The following command will run all the tests. | ||||||||||||||
| `npm run test` | ||||||||||||||
|
|
||||||||||||||
| ### One file at a time | ||||||||||||||
| There are a lot of tests in `solid-ui` so you will most likely want to run only the test you are working on at the moment. In order to do that you can use the following command. | ||||||||||||||
SharonStrats marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||
| `npm test <filetobetested>` | ||||||||||||||
| `npm test test/unit/utils/keyHelpers/accessData.test.ts` | ||||||||||||||
|
|
||||||||||||||
| ### Coverage | ||||||||||||||
| Run the following command: | ||||||||||||||
| `npm run coverage` | ||||||||||||||
|
|
||||||||||||||
| Then you can see the results in `coverage/lcov-report/index.html`. If you are using VSCode you can right click and select to `Open in Browser Preview`. Otherwise, you can type the path in your browswer, for instance `file:///Users/<yourhomedirectory>/2023Development/solid-ui/coverage/lcov-report/index.html` is an example. | ||||||||||||||
SharonStrats marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||
|
|
||||||||||||||
| ## Tips and Tricks | ||||||||||||||
| The following are some tips and tricks in hopes to make testing easier. | ||||||||||||||
SharonStrats marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||
|
|
||||||||||||||
| ### VSCode Debugging | ||||||||||||||
| There is an extension that can be used to aide in debugging jest tests. To find out more about it you can look at [Jest Runner](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) | ||||||||||||||
SharonStrats marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||
|
|
||||||||||||||
| ### Mocking | ||||||||||||||
| In solid-ui we do not currently follow a MVC pattern therefore there can be some difficulty in testing. The following are patterns to help with this. | ||||||||||||||
SharonStrats marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||
| #### Store methods | ||||||||||||||
| ##### Load | ||||||||||||||
| In SolidOS we use [rdflib.js](https://github.com/linkeddata/rdflib.js/) to work with LinkedData. The way this works is that you first load the document you need to work with into the store. Once the document is loaded you can then access the data by using additional methods on the store such as `any, each,...`. Since the data that gets returned will need to be mocked, `load` doesn't need to do anything. See below for what you need to put in the top of your file in order to mock the `load` method. | ||||||||||||||
| `import { store } from 'solid-logic'` at the top of your file. | ||||||||||||||
|
|
||||||||||||||
| `store.fetcher.load = jest.fn().mockImplementation(() => {})` | ||||||||||||||
SharonStrats marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||
|
|
||||||||||||||
| ### Mock the fetcher | ||||||||||||||
| ##### Any | ||||||||||||||
|
|
||||||||||||||
| ##### Each | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @TallTed thank you for all the corrections. |
||||||||||||||
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.