use crate::backends::SchemaEditorResult;
use crate::backends::schema::BaseDatabaseSchemaEditor;
use crate::backends::types::DatabaseType;
use async_trait::async_trait;
#[derive(Debug, Clone, Copy)]
pub struct MockSchemaEditor;
impl MockSchemaEditor {
pub fn new() -> Self {
Self
}
}
impl Default for MockSchemaEditor {
fn default() -> Self {
Self::new()
}
}
#[async_trait]
impl BaseDatabaseSchemaEditor for MockSchemaEditor {
fn database_type(&self) -> DatabaseType {
DatabaseType::Sqlite
}
async fn execute(&mut self, _sql: &str) -> SchemaEditorResult<()> {
Ok(())
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_mock_schema_editor_creation() {
let editor = MockSchemaEditor::new();
assert_eq!(editor.database_type(), DatabaseType::Sqlite);
}
#[test]
fn test_mock_schema_editor_default() {
let editor = MockSchemaEditor::default();
assert_eq!(editor.database_type(), DatabaseType::Sqlite);
}
}