Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
guillemcordoba committed Oct 17, 2024
1 parent 0f90564 commit 28e06d7
Showing 6 changed files with 38 additions and 80 deletions.
52 changes: 5 additions & 47 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
"@msgpack/msgpack": "^2.8.0",
"@holochain/client": "^0.17.1",
"@holochain/tryorama": "^0.16.0",
"@holochain-open-dev/signals": "^0.300.6",
"@holochain-open-dev/signals": "^0.300.8",
"@holochain-open-dev/utils": "^0.300.2",
"typescript": "^4.9.4",
"vitest": "^1.4.0"
5 changes: 2 additions & 3 deletions tests/src/profile.test.ts
Original file line number Diff line number Diff line change
@@ -30,8 +30,7 @@ test('create Profile', async () => {
agentsWithProfile = await toPromise(alice.store.allProfiles);
assert.equal(agentsWithProfile.size, 1);

const profileStatus = alice.store.myProfile.get();
assert.equal(profileStatus.status, 'completed');
assert.ok((profileStatus as any).value);
const aliceProfile = await toPromise(alice.store.myProfile);
assert.ok(aliceProfile);
});
});
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
},
"dependencies": {
"@holochain-open-dev/elements": "^0.300.1",
"@holochain-open-dev/signals": "^0.300.8",
"@holochain-open-dev/signals": "^0.300.9",
"@holochain-open-dev/utils": "^0.300.2",
"@holochain/client": "^0.17.1",
"@lit/context": "^1.0.1",
17 changes: 9 additions & 8 deletions ui/src/profiles-store.ts
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import {
mapCompleted,
pipe,
queryLiveEntriesSignal,
toPromise,
} from '@holochain-open-dev/signals';
import { EntryRecord, LazyHoloHashMap, slice } from '@holochain-open-dev/utils';
import { ActionHash, AgentPubKey, encodeHashToBase64 } from '@holochain/client';
@@ -31,26 +32,26 @@ export class ProfilesStore {
// At startup, clear all the cap grants that might have been left over from an unfinished link agent process
this.client.clearLinkAgent();

this.createClaimWhenLinked();
}

private async createClaimWhenLinked() {
const myProfile = await toPromise(this.myProfile);

if (myProfile !== undefined) return;

effect(() => {
const claims = this.myProfileClaims.get();
const myProfile = this.myProfile.get();

console.log('hey1');

if (claims.status !== 'completed' || claims.value.length > 0) return;
if (myProfile.status !== 'completed' || myProfile.value !== undefined)
return;

console.log('hey2');
// Expensive subscription
const agentToProfileLinks = this.myProfileLinks.get();
if (agentToProfileLinks.status !== 'completed') return;
console.log('hey3', agentToProfileLinks.value);

if (agentToProfileLinks.value.length > 0) {
if (this._creatingClaim) return;
this._creatingClaim = true;
console.log('creating');
const link = agentToProfileLinks.value[0];
this.client
.createProfileClaim({
40 changes: 20 additions & 20 deletions ui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"compilerOptions": {
"target": "es2018",
"module": "esnext",
"moduleResolution": "node",
"noEmitOnError": true,
"lib": ["es2017", "dom"],
"strict": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"importHelpers": true,
"incremental": true,
"outDir": "dist",
"sourceMap": true,
"inlineSources": true,
"declaration": true,
"rootDir": "./src",
"skipLibCheck": true
},
"include": ["src/**/*.ts"]
"compilerOptions": {
"target": "es2018",
"module": "esnext",
"moduleResolution": "node",
"noEmitOnError": true,
"lib": ["es2018", "dom"],
"strict": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"importHelpers": true,
"incremental": true,
"outDir": "dist",
"sourceMap": true,
"inlineSources": true,
"declaration": true,
"rootDir": "./src",
"skipLibCheck": true
},
"include": ["src/**/*.ts"]
}

0 comments on commit 28e06d7

Please sign in to comment.