Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Leblow committed Nov 29, 2023
1 parent 1aac189 commit b602735
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 9 deletions.
56 changes: 55 additions & 1 deletion packages/desktop/src/rtl-tests/channel.main.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,15 @@ describe('Channel', () => {
nickname: 'alice',
})

initialState.dispatch(
communities.actions.updateCommunityData({
id: community.id,
// null/undefined type mismatch here. Might make things easier
// to make it consistent.
ownerCertificate: alice.userCertificate || undefined,
})
)

let cid = ''

const uploadingDelay = 100
Expand Down Expand Up @@ -897,6 +906,15 @@ describe('Channel', () => {
nickname: 'alice',
})

initialState.dispatch(
communities.actions.updateCommunityData({
id: community.id,
// null/undefined type mismatch here. Might make things easier
// to make it consistent.
ownerCertificate: alice.userCertificate || undefined,
})
)

const message = Math.random().toString(36).substr(2.9)

const entities = initialState.getState().PublicChannels.channels.entities
Expand Down Expand Up @@ -1021,11 +1039,20 @@ describe('Channel', () => {
const community =
await factory.create<ReturnType<typeof communities.actions.addNewCommunity>['payload']>('Community')

await factory.create<ReturnType<typeof identity.actions.addNewIdentity>['payload']>('Identity', {
const alice = await factory.create<ReturnType<typeof identity.actions.addNewIdentity>['payload']>('Identity', {
id: community.id,
nickname: 'alice',
})

initialState.dispatch(
communities.actions.updateCommunityData({
id: community.id,
// null/undefined type mismatch here. Might make things easier
// to make it consistent.
ownerCertificate: alice.userCertificate || undefined,
})
)

jest.spyOn(socket, 'emit').mockImplementation(async (...input: [SocketActionTypes, ...socketEventData<[any]>]) => {
const action = input[0]
if (action === SocketActionTypes.LAUNCH_COMMUNITY) {
Expand Down Expand Up @@ -1122,6 +1149,15 @@ describe('Channel', () => {
nickname: 'alice',
})

initialState.dispatch(
communities.actions.updateCommunityData({
id: community.id,
// null/undefined type mismatch here. Might make things easier
// to make it consistent.
ownerCertificate: alice.userCertificate || undefined,
})
)

const messageId = Math.random().toString(36).substr(2.9)
const entities = initialState.getState().PublicChannels.channels.entities
const generalId = Object.keys(entities).find(key => entities[key]?.name === 'general')
Expand Down Expand Up @@ -1238,6 +1274,15 @@ describe('Channel', () => {
nickname: 'alice',
})

initialState.dispatch(
communities.actions.updateCommunityData({
id: community.id,
// null/undefined type mismatch here. Might make things easier
// to make it consistent.
ownerCertificate: alice.userCertificate || undefined,
})
)

const messageId = Math.random().toString(36).substr(2.9)
const entities = initialState.getState().PublicChannels.channels.entities
const generalId = Object.keys(entities).find(key => entities[key]?.name === 'general')
Expand Down Expand Up @@ -1356,6 +1401,15 @@ describe('Channel', () => {
nickname: 'alice',
})

initialState.dispatch(
communities.actions.updateCommunityData({
id: community.id,
// null/undefined type mismatch here. Might make things easier
// to make it consistent.
ownerCertificate: alice.userCertificate || undefined,
})
)

const messageId = Math.random().toString(36).substr(2.9)
const entities = initialState.getState().PublicChannels.channels.entities
const generalId = Object.keys(entities).find(key => entities[key]?.name === 'general')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ describe('verifyMessage saga test', () => {
aliceCsr = alice.userCsr?.userCsr || ''

store.dispatch(
communitiesActions.updateCommunityData(
{
id: community.id,
// null/undefined type mismatch here. Might make things easier
// to make it consistent.
ownerCertificate: alice.userCertificate || undefined,
}
)
communitiesActions.updateCommunityData({
id: community.id,
// null/undefined type mismatch here. Might make things easier
// to make it consistent.
ownerCertificate: alice.userCertificate || undefined,
})
)

bob = await factory.create<ReturnType<typeof identityActions.addNewIdentity>['payload']>('Identity', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function* verifyMessagesSaga(
if (ownerData?.pubKey) {
break
}
console.warn('Owner certificate missing!')
yield* delay(500)
}

Expand Down

0 comments on commit b602735

Please sign in to comment.