diff --git a/tests/src/basic-chatting.ts b/tests/src/basic-chatting.ts index 2b7b05d..c32dc04 100644 --- a/tests/src/basic-chatting.ts +++ b/tests/src/basic-chatting.ts @@ -2,7 +2,6 @@ import * as _ from 'lodash' import { v4 as uuidv4 } from "uuid"; import { localConductorConfig, delay } from './common' import { installAgents } from './installAgents' -import { getTimestamp } from './utils' module.exports = async (orchestrator) => { @@ -75,7 +74,7 @@ module.exports = async (orchestrator) => { // Alice lists the messages var msgs: any[] = []; - let batch_payload = { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 } + let batch_payload = { channel: channel.entry, active_chatter: false, target_message_count: 2 } msgs.push(await alice_chat.call('chat', 'list_messages', batch_payload)); console.log(_.map(msgs[0].messages, messageEntry)); t.deepEqual([sends[0].entry, sends[1].entry], _.map(msgs[0].messages, messageEntry)); diff --git a/tests/src/pagination.ts b/tests/src/pagination.ts index e1e2488..142ac10 100644 --- a/tests/src/pagination.ts +++ b/tests/src/pagination.ts @@ -2,7 +2,6 @@ import * as _ from 'lodash' import { v4 as uuidv4 } from "uuid"; import { localConductorConfig, delay, awaitIntegration } from './common' import { installAgents } from './installAgents' -import { getTimestamp } from './utils' module.exports = async (orchestrator) => { @@ -75,17 +74,17 @@ module.exports = async (orchestrator) => { await awaitIntegration(bobbo_chat) // Alice lists the messages - let alices_view = await alice_chat.call('chat', 'list_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 }) + let alices_view = await alice_chat.call('chat', 'list_messages', { channel: channel.entry, active_chatter: false, target_message_count: 2 }) - let bobbos_view = await bobbo_chat.call('chat', 'list_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 }) + let bobbos_view = await bobbo_chat.call('chat', 'list_messages', { channel: channel.entry, active_chatter: false, target_message_count: 2 }) if (alices_view.messages.length !== 2) { await delay(10000) console.log("Trying again..."); - alices_view = await alice_chat.call('chat', 'list_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 }) + alices_view = await alice_chat.call('chat', 'list_messages', { channel: channel.entry, active_chatter: false, target_message_count: 2 }) - bobbos_view = await bobbo_chat.call('chat', 'list_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 }) + bobbos_view = await bobbo_chat.call('chat', 'list_messages', { channel: channel.entry, active_chatter: false, target_message_count: 2 }) } t.deepEqual(alices_view.messages.length, 2) t.deepEqual(bobbos_view.messages.length, 2) @@ -116,12 +115,14 @@ module.exports = async (orchestrator) => { t.deepEqual(sends[3].entry, recvs[3].entry); await delay(4000) // Alice lists the messages - alices_view = await alice_chat.call('chat', 'list_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 20 }) + alices_view = await alice_chat.call('chat', 'list_messages', { channel: channel.entry, active_chatter: false, target_message_count: 20 }) // Bobbo lists the messages - bobbos_view = await bobbo_chat.call('chat', 'list_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 10 }) + bobbos_view = await bobbo_chat.call('chat', 'list_messages', { channel: channel.entry, active_chatter: false, target_message_count: 10 }) t.deepEqual(alices_view.messages.length, 4) t.deepEqual(bobbos_view.messages.length, 4) - + console.log("ALICE ", alices_view); + console.log("BOBBO: ", bobbos_view); + }) } diff --git a/tests/src/transient-nodes.ts b/tests/src/transient-nodes.ts index 55028fc..35eb08c 100644 --- a/tests/src/transient-nodes.ts +++ b/tests/src/transient-nodes.ts @@ -2,7 +2,6 @@ import * as _ from 'lodash' import { v4 as uuidv4 } from "uuid"; import { RETRY_DELAY, RETRY_COUNT, localConductorConfig, networkedConductorConfig, awaitIntegration, delay } from './common' import { installAgents } from './installAgents' -import { getTimestamp } from './utils' module.exports = async (orchestrator) => { orchestrator.registerScenario('transient nodes-local', async (s, t) => { @@ -19,7 +18,7 @@ const gotChannelsAndMessages = async(t, name, happ, channelEntry, retry_count, r while (true) { const channel_list = await happ.call('chat', 'list_channels', { category: "General" }); console.log(`${name}'s channel list:`, channel_list.channels); - let batch_payload = { channel: channelEntry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 } + let batch_payload = { channel: channelEntry, active_chatter: false, target_message_count: 2 } const r = await happ.call('chat', 'list_messages', batch_payload) t.ok(r) diff --git a/tests/src/utils.ts b/tests/src/utils.ts deleted file mode 100644 index 9f1baa8..0000000 --- a/tests/src/utils.ts +++ /dev/null @@ -1 +0,0 @@ -export const getTimestamp = () => (Date.now() * 1000) diff --git a/zomes/chat/src/entries/message/handlers.rs b/zomes/chat/src/entries/message/handlers.rs index aeb04c2..cfc7cf6 100644 --- a/zomes/chat/src/entries/message/handlers.rs +++ b/zomes/chat/src/entries/message/handlers.rs @@ -43,7 +43,7 @@ pub(crate) fn create_message(message_input: MessageInput) -> ChatResult = path.as_ref(); let hour = String::try_from(&hp[hp.len() - 1])?; - debug!("COMMITING TO HOUR::: {:?}", hour); + debug!("committing message to hour {:?}", hour); // Get the hash of the last_seen of this message let parent_hash_entry = match last_seen { LastSeen::Message(hash_entry) => hash_entry,