Skip to content

Commit

Permalink
testing: revert the api name
Browse files Browse the repository at this point in the history
  • Loading branch information
zo-el committed Nov 8, 2021
1 parent 452aa9e commit 8e758e5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions tests/src/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ module.exports = async (orchestrator) => {

// Alice lists the messages
const getTimestamp = () => (Date.now() * 1000)
let alices_view = await alice_chat.call('chat', 'list_messages_batch', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 })
let alices_view = await alice_chat.call('chat', 'list_page_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 })

let bobbos_view = await bobbo_chat.call('chat', 'list_messages_batch', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 })
let bobbos_view = await bobbo_chat.call('chat', 'list_page_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), 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_batch', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 })
alices_view = await alice_chat.call('chat', 'list_page_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 })

bobbos_view = await bobbo_chat.call('chat', 'list_messages_batch', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 })
bobbos_view = await bobbo_chat.call('chat', 'list_page_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 })
}
t.deepEqual(alices_view.messages.length, 2)
t.deepEqual(bobbos_view.messages.length, 2)
Expand Down Expand Up @@ -116,9 +116,9 @@ 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_batch', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 20 })
alices_view = await alice_chat.call('chat', 'list_page_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 20 })
// Bobbo lists the messages
bobbos_view = await bobbo_chat.call('chat', 'list_messages_batch', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 10 })
bobbos_view = await bobbo_chat.call('chat', 'list_page_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 10 })
bobbos_view.messages.forEach(msg => {
console.log(">>>>>>>", msg.entry);
});
Expand Down
2 changes: 1 addition & 1 deletion zomes/chat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ fn list_messages(list_messages_input: ListMessagesInput) -> ExternResult<ListMes
}

#[hdk_extern]
fn list_messages_batch(list_messages_input: ListMessagesBatchInput) -> ExternResult<ListMessages> {
fn list_page_messages(list_messages_input: ListMessagesBatchInput) -> ExternResult<ListMessages> {
Ok(message::handlers::list_messages_batch(list_messages_input)?)
}

Expand Down
2 changes: 1 addition & 1 deletion zomes/chat/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub fn set_read_only_cap_tokens() -> ExternResult<()> {
functions.insert((zome_info()?.zome_name, "get_active_chatters".into()));
functions.insert((zome_info()?.zome_name, "list_channels".into()));
functions.insert((zome_info()?.zome_name, "list_messages".into()));
functions.insert((zome_info()?.zome_name, "list_messages_batch".into()));
functions.insert((zome_info()?.zome_name, "list_page_messages".into()));
functions.insert((zome_info()?.zome_name, "list_all_messages".into()));
functions.insert((zome_info()?.zome_name, "stats".into()));
functions.insert((zome_info()?.zome_name, "agent_stats".into()));
Expand Down

0 comments on commit 8e758e5

Please sign in to comment.