Skip to content

Commit

Permalink
feat: remove isPending in peerConnection metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Sotatek-HocNguyena committed May 8, 2024
1 parent 532b7d0 commit 1e55db1
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 16 deletions.
4 changes: 0 additions & 4 deletions src/core/agent/records/peerConnectionMetadataRecord.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const mockData: PeerConnectionMetadataRecordProps = {
url: "url",
iconB64: "icon",
selectedAid: "aid",
isPending: false,
};

describe("Peer Connection Record", () => {
Expand All @@ -26,9 +25,6 @@ describe("Peer Connection Record", () => {
expect(settingsRecord.url).toBe(mockData.url);
expect(settingsRecord.selectedAid).toBe(mockData.selectedAid);
expect(settingsRecord.iconB64).toBe(mockData.iconB64);
expect(settingsRecord.getTags()).toMatchObject({
isPending: mockData.isPending,
});
expect(settingsRecord.createdAt).toBe(createdAt);
});
});
4 changes: 0 additions & 4 deletions src/core/agent/records/peerConnectionMetadataRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ interface PeerConnectionMetadataRecordProps {
name?: string;
url?: string;
createdAt?: Date;
isPending?: boolean;
iconB64?: string;
selectedAid?: string;
}

class PeerConnectionMetadataRecord extends BaseRecord {
name?: string;
isPending?: boolean;
url?: string;
iconB64?: string;
selectedAid?: string;
Expand All @@ -27,7 +25,6 @@ class PeerConnectionMetadataRecord extends BaseRecord {
this.id = props.id;
this.name = props.name ?? "";
this.url = props.url ?? "";
this.isPending = props.isPending ?? true;
this.selectedAid = props.selectedAid ?? "";
this.createdAt = props.createdAt ?? new Date();
this.iconB64 = props.iconB64 ?? "";
Expand All @@ -37,7 +34,6 @@ class PeerConnectionMetadataRecord extends BaseRecord {
getTags() {
return {
...this._tags,
isPending: this.isPending,
};
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/core/agent/records/peerConnectionStorage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const peerConnectionMetadataRecordProps = {
url: "url",
iconB64: "icon",
selectedAid: "aid",
isPending: true,
createdAt: new Date(),
};

Expand Down Expand Up @@ -80,7 +79,7 @@ describe("Connection service of agent", () => {
await peerConnectionStorage.updatePeerConnectionMetadata(
peerConnectionMetadataRecord.id,
{
isPending: false,
name: "update name",
}
);
expect(storageService.update).toBeCalled();
Expand Down
4 changes: 1 addition & 3 deletions src/core/agent/records/peerConnectionStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class PeerConnectionStorage {
metadata: Partial<
Pick<
PeerConnectionMetadataRecord,
"name" | "url" | "iconB64" | "selectedAid" | "isPending"
"name" | "url" | "iconB64" | "selectedAid"
>
>
): Promise<void> {
Expand All @@ -55,8 +55,6 @@ class PeerConnectionStorage {
identifierMetadataRecord.iconB64 = metadata.iconB64;
if (metadata.selectedAid !== undefined)
identifierMetadataRecord.selectedAid = metadata.selectedAid;
if (metadata.isPending !== undefined)
identifierMetadataRecord.isPending = metadata.isPending;
await this.storageService.update(identifierMetadataRecord);
}

Expand Down
2 changes: 0 additions & 2 deletions src/core/agent/services/peerConnectionService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ const peerConnectionMetadataRecordProps = {
url: "url",
iconB64: "icon",
selectedAid: "aid",
isPending: true,
createdAt: new Date(),
};

Expand Down Expand Up @@ -165,7 +164,6 @@ describe("Peer connection service of agent", () => {
url: "url1",
iconB64: "icon1",
selectedAid: "aid1",
isPending: true,
createdAt: new Date(),
};
peerConnectionStorage.getPeerConnectionMetadata = jest
Expand Down
2 changes: 1 addition & 1 deletion src/core/agent/services/peerConnectionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PeerConnectionService extends AgentService {
identifier: string,
data: Pick<
PeerConnectionMetadataRecordProps,
"name" | "url" | "selectedAid" | "iconB64" | "isPending"
"name" | "url" | "selectedAid" | "iconB64"
>
): Promise<PeerConnectionMetadataRecord> {
await this.peerConnectionStorage.updatePeerConnectionMetadata(
Expand Down

0 comments on commit 1e55db1

Please sign in to comment.