Skip to content

Commit

Permalink
Revert "More"
Browse files Browse the repository at this point in the history
This reverts commit e117848.
  • Loading branch information
islathehut committed May 13, 2024
1 parent e117848 commit 726bf59
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { connectionActions } from '../connection.slice'
export function* uptimeSaga(): Generator {
// There is no point in updating this more often as we don't need precise data here, but we want to avoid spamming redux with excess actions
const interval = 10000
console.log(`Updating uptime on interval ${interval}ms`)
console.info(`Updating uptime on interval ${interval}ms`)
while (true) {
yield* put(connectionActions.updateUptime(interval))
yield* delay(interval)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function* autoDownloadFilesSaga(
): Generator {
const identity = yield* select(identitySelectors.currentIdentity)
if (!identity) {
console.error('Could not autodownload files, no identity')
logger.error('Could not autodownload files, no identity')
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function* createChannelSaga(
socket: Socket,
action: PayloadAction<ReturnType<typeof publicChannelsActions.createChannel>['payload']>
): Generator {
console.log(`Creating channel ${action.payload.channel.name}`)
console.info(`Creating channel ${action.payload.channel.name}`)

const response = yield* apply(
socket,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function* createGeneralChannelSaga(): Generator {
console.error('Could not create general channel. No identity')
return
}
console.log(`Creating general channel for ${identity.nickname}`)
console.info(`Creating general channel for ${identity.nickname}`)

const timestamp = yield* call(getChannelTimestamp)
const id = yield* call(generateChannelId, 'general')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function* deleteChannelSaga(

const isGeneral = channelId === generalChannel.id

console.log(`Deleting channel ${channelId}`)
console.info(`Deleting channel ${channelId}`)

const response = yield* apply(
socket,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const getGeneralChannelId = (state: PublicChannelsState) => {
const selectors = publicChannelsAdapter.getSelectors()
const publicChannelStorage = selectors.selectAll(state.channels)
const generalChannel = publicChannelStorage.find(channel => channel.name === 'general')
console.log('PublicChannelsTransform: existing general channel id', generalChannel?.id)
console.info('PublicChannelsTransform: existing general channel id', generalChannel?.id)
const generalChannelId = generalChannel?.id || INITIAL_CURRENT_CHANNEL_ID
console.log('PublicChannelsTransform: new general channel id', generalChannelId)
console.info('PublicChannelsTransform: new general channel id', generalChannelId)
return generalChannelId
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function* saveUserProfileSaga(socket: Socket, action: PayloadAction<{ pho
pubKey,
}

console.log(`Saving user profile: ${userProfile}`)
console.info(`Saving user profile: ${userProfile}`)

yield* apply(socket, socket.emit, applyEmitParams(SocketActionTypes.SET_USER_PROFILE, userProfile))
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export const storybookLog =
(message: string) =>
(...args: unknown[]): void => {
console.log(message)
console.info(message)

if (args.length > 0) {
args.forEach(arg => {
console.log(arg)
console.info(arg)
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ describe('storybookLog function', () => {
expect(typeof returned).toEqual('function')
})

it('should call `console.log` with passed message', () => {
it('should call `console.info` with passed message', () => {
storybookLog(consoleLogMessage)()

expect(console.log).toHaveBeenCalledWith(consoleLogMessage)
expect(console.log).toHaveBeenCalledTimes(1)
expect(console.info).toHaveBeenCalledWith(consoleLogMessage)
expect(console.info).toHaveBeenCalledTimes(1)
})

it('should call `console.log` with passed args', () => {
it('should call `console.info` with passed args', () => {
const args = ['something', 5]
storybookLog(consoleLogMessage)(...args)

expect(console.log).toHaveBeenCalledWith(consoleLogMessage)
expect(console.log).toHaveBeenCalledWith(args[0])
expect(console.log).toHaveBeenCalledWith(args[1])
expect(console.log).toHaveBeenCalledTimes(3)
expect(console.info).toHaveBeenCalledWith(consoleLogMessage)
expect(console.info).toHaveBeenCalledWith(args[0])
expect(console.info).toHaveBeenCalledWith(args[1])
expect(console.info).toHaveBeenCalledTimes(3)
})
})

0 comments on commit 726bf59

Please sign in to comment.