-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add Orbit & DDB basics #94
Conversation
f5cfa63
to
390b4c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still very rough. It looks to me like it's still a work-in-progress.
Please see my comments and align this PR with our rules in the codebase.
Please use the included prettier
and eslint
rules as those will help you avoid most things I've outlined.
👍
integration-testing/data/factory.js
Outdated
@@ -0,0 +1,134 @@ | |||
import rimraf from 'rimraf'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put this file under ./integration-testing/utils
to not mix it up with the tests
@@ -3,6 +3,9 @@ | |||
"rootDir": "integration-testing", | |||
"globalSetup": "./utils/integration-testing-setup.js", | |||
"globalTeardown": "./utils/integration-testing-teardown.js", | |||
"setupFiles": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going do generate a merge conflict, as I've also added a bunch of files in #93
src/data/index.js
Outdated
|
||
subscribe(f) { | ||
this._store.events.on('replicated', () => { | ||
// console.log( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this commented out code needed, or just a leftover ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to keep these around to quickly uncomment and track my errors, I'll remove it.
Do we have a preferred logging library that'd let me log debug / info / warn / alert with namespaced loggers that you can enable and disable with a piece of config?
src/data/index.js
Outdated
} | ||
|
||
async getUserProfile(key: PublicKey): Promise<UserProfile> { | ||
// console.log('Build User Profile Store with key=', key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, are these needed, or can they be removed ?
|
||
let update = {}; | ||
p2.subscribe(x => { | ||
console.log('Subscription triggered with x=', x); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of console.log
statements all over the tests. Do we need this ?
As they seem to me to be more for a debugging purpose.
import { retryUntilValue } from '../utils/tools'; | ||
|
||
let factory = null; | ||
let pinner = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable is not used in this file.
await factory.clear(); | ||
}, Factory.TIMEOUT); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the extra line here.
|
||
test('Create my user profile and set its name', async () => { | ||
const p1 = await data2.getMyUserProfile(); | ||
let name = factory.name('Kanye West'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name
is never reassigned, please use const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have a linter precommit hook? That'd be a good thing to set up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I passed yarn lint before pushing.
We need to add integration-testing/
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, good point 👍
Although, curiously, my editor's linter (which takes it's rules from the local project's .eslintrc
) works...
expect(p1.getName()).toBe(name); | ||
}); | ||
|
||
test('Create my user profile and set its name sync with another', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line exceeds the max length of 80
.
Please use the included prettier
and eslint
rules.
|
||
expect(p1.isEmpty()).toBeFalsy(); | ||
expect(await retryUntilValue(() => p2.isEmpty(), { value: false })).toBeFalsy(); | ||
expect(await retryUntilValue(() => p2.getName(), { value: name })).toBe(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two lines exceed the max length of 80
.
Please use the included prettier
and eslint
rules.
42d84ff
to
1d3ef14
Compare
@rdig I And doesn't follow our coding style (it puts what's your prettier setup? |
I'll add it in and fix it in #112 |
1d3ef14
to
4b82688
Compare
Added in #112 There's a manual command to lint integration tests files: But everything is wired up to check these at commit time. |
4b82688
to
7f95222
Compare
@rdig thanks for the thorough review, my editors are now configured with our complete coding style and I fixed all your comments ;) Could you take another look? Also, do you Squash & Rebase or just Merge? I kept small & focused commits to make the review easier for now. |
I'll try to make some time today
As long as the commits are made with common sense we don't squash, just merge. I we do ever decide to squash, it's going to be brought up in the review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this is good to go now.
Tests output it much cleaner:
There's still some eslint
errors left, but these have to do with rule config, rather than code: (this is fixed in #112 so just ignore it for now)
PS: Please rebase on the latest master
and re-run tests with the updated versions of the submodules to make sure they still pass
Nice work Laurent 💯
7f95222
to
de2bfdd
Compare
@rdig Arr, the PR is ready to merge, but something broke with the Colony Client apparently: |
There's a lot of things that seem to be failing:
I'll take a look tommorow at it and possibly fix it. |
b922674
to
5b7f15d
Compare
bf78f62
to
ed14f4d
Compare
Yea, there's a bug in the libp2p suite,
The tests show this error but succeed anyway? |
Yes because the
Yes, but add a |
ed14f4d
to
58094b4
Compare
- add initial integration testing code - add ipfs and orbit nodes - add pinner mock to fix data ipfs tests - add testing with orbitdb - add a testing factory for ipfs / orbit & cleanup tests
- set name and retrieve - tests - subscriptions & load store
5c6ab92
to
9513849
Compare
Description
Deps
New dependencies:
ipfs
: Storage used by orbit-db.orbit-db
: Decentralized database