You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: episode_tests.rs
    path of file: ./repos/dim/dim-database/src/tests
    
    the code of the file until where you have to start completion: use crate::episode;
use crate::get_conn_memory;
use crate::media;
use crate::season;
use crate::write_tx;

use super::library_tests::create_test_library;
use super::media_tests::insert_media;

use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering;

#[tokio::test(flavor = "multi_thread")]
async fn test_insert_get_and_delete() {
    let mut conn = get_conn_memory().await.unwrap().writer().lock_owned().await;
    let mut tx = write_tx(&mut conn).await.unwrap();
    let _lib = create_test_l
    
async fn test_get_first_of_season() {
    let mut conn = get_conn_memory().await.unwrap().writer().lock_owned().await;
    let mut tx = write_tx(&mut conn).await.unwrap();
    let _lib = create_test_library(&mut tx).await;
    let tv = insert_media(&mut tx).await;

    let season = season::InsertableSeason {
        season_number: 1,
        ..Default::default()
    }
    .insert(&mut tx, tv)
    .await
    .unwrap();

    let result = episode::Episode::get_first_for_season(&mut tx, season).await;
    assert!(result.is_err());

    for i in 3..=5 {
        let _episode = episode::InsertableEpisode {
            media: media::InsertableMedia {
                library_id: _lib,
                name: format!("TestEpisode{}", i),
                ..Default::default()
            },
            seasonid: season,
            episode: i,
        }
        .insert(&mut tx)
        .await
        .unwrap();
    }

    let result = episode::Episode::get_first_for_season(&mut tx, season)
        .await
        .unwrap();
    assert_eq!(result.episode, 3);

    for i in 1..=2 {
        let _episode = episode::InsertableEpisode {
            media: media::InsertableMedia {
                library_id: _lib,
                name: format!("TestEpisode{}", i),
                ..Default::default()
            },
            seasonid: season,
            episode: i,
        }
        .insert(&mut tx)
        .await
        .unwrap();
    }

    let result = episode::Episode::get_first_for_season(&mut tx, season)
        .await
        .unwrap();
    assert_eq!(result.episode, 1);
}