// Copyright (c) 2026 Kirky.X
//
// Licensed under the MIT License
// See LICENSE file in the project root for full license information.

//! Metadata 模块单元测试

#[cfg(test)]
mod tests {
    use dbnexus::migration::metadata::{MigrationMetadata, TableSnapshot};

    #[test]
    fn test_create_metadata() {
        let metadata = MigrationMetadata::new(
            1,
            "test_migration".to_string(),
            "CREATE TABLE test (id INT);".to_string(),
        );
        assert_eq!(metadata.version, 1);
        assert_eq!(metadata.name, "test_migration");
        assert!(metadata.table_snapshots.is_empty());
    }

    #[test]
    fn test_add_table_snapshot() {
        let mut metadata = MigrationMetadata::new(1, "test".to_string(), "CREATE TABLE test (id INT);".to_string());
        let snapshot = TableSnapshot::new("test".to_string());
        metadata.add_table_snapshot(snapshot);
        assert_eq!(metadata.table_snapshots.len(), 1);
    }
}
