Add basic randomized integration test for channel notes

This commit is contained in:
Max Brunsfeld 2023-09-06 14:09:36 -07:00
parent 66c3879306
commit e779adfe46
6 changed files with 295 additions and 39 deletions

View file

@ -1,6 +1,20 @@
use super::*;
impl Database {
#[cfg(test)]
pub async fn all_channels(&self) -> Result<Vec<(ChannelId, String)>> {
self.transaction(move |tx| async move {
let mut channels = Vec::new();
let mut rows = channel::Entity::find().stream(&*tx).await?;
while let Some(row) = rows.next().await {
let row = row?;
channels.push((row.id, row.name));
}
Ok(channels)
})
.await
}
pub async fn create_root_channel(
&self,
name: &str,