Skip to content

Commit

Permalink
fix: add missing file and fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
EmiM committed Apr 12, 2024
1 parent ffaea57 commit f5c7925
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/backend/src/nest/storage/storage.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { CertificatesRequestsStore } from './certifacteRequests/certificatesRequ
import { CertificatesStore } from './certificates/certificates.store'
import { CommunityMetadataStore } from './communityMetadata/communityMetadata.store'
import { OrbitDb } from './orbitDb/orbitDb.service'
import { UserProfileStore } from './userProfile/userProfile.store'

const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
Expand Down Expand Up @@ -72,6 +73,7 @@ describe('StorageService', () => {
let certificatesRequestsStore: CertificatesRequestsStore
let certificatesStore: CertificatesStore
let communityMetadataStore: CommunityMetadataStore
let userProfileStore: UserProfileStore
let orbitDbService: OrbitDb
let peerId: PeerId

Expand Down Expand Up @@ -135,7 +137,7 @@ describe('StorageService', () => {
certificatesRequestsStore = await module.resolve(CertificatesRequestsStore)
certificatesStore = await module.resolve(CertificatesStore)
communityMetadataStore = await module.resolve(CommunityMetadataStore)
console.log({ communityMetadataStore })
userProfileStore = await module.resolve(UserProfileStore)
lazyModuleLoader = await module.resolve(LazyModuleLoader)

orbitDbDir = await module.resolve(ORBIT_DB_DIR)
Expand Down Expand Up @@ -262,16 +264,17 @@ describe('StorageService', () => {
const certificatesDbAddress = certificatesStore.getAddress()
const certificatesRequestsDbAddress = certificatesRequestsStore.getAddress()
const communityMetadataDbAddress = communityMetadataStore.getAddress()
const userProfileDbAddress = userProfileStore.getAddress()
expect(channelsDbAddress).not.toBeFalsy()
expect(certificatesDbAddress).not.toBeFalsy()
expect(subscribeToPubSubSpy).toBeCalledTimes(2)
// Storage initialization:
expect(subscribeToPubSubSpy).toHaveBeenNthCalledWith(1, [
StorageService.dbAddress(communityMetadataDbAddress),
StorageService.dbAddress(channelsDbAddress),
StorageService.dbAddress(certificatesDbAddress),
StorageService.dbAddress(certificatesRequestsDbAddress),
StorageService.dbAddress(communityMetadataDbAddress),
'/orbitdb/zdpuAyScVHonV7KUdb3rdNmC9ZurssGdfgveYm3ds7KNJ6CpU/user-profiles',
StorageService.dbAddress(userProfileDbAddress),
])
// Creating channel:
expect(subscribeToPubSubSpy).toHaveBeenNthCalledWith(2, [StorageService.dbAddress(db.address)])
Expand Down
7 changes: 7 additions & 0 deletions packages/e2e-tests/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { App } from './selectors'

export interface UserTestData {
username: string
app: App
messages: string[]
}

0 comments on commit f5c7925

Please sign in to comment.