How do you write unit test for contracts?

According to this docs, it is a script and did not show which directory is it yet nor the imported files. How do you test the contract instance? Showing this code snippet doesn’t help us in elaborating how to unit tests from contract.

contract;
 
abi CallerContract {
    fn test_false() -> bool;
}
 
impl CallerContract for Contract {
    fn test_false() -> bool {
        false
    }
}
 
abi CalleeContract {
    fn test_true() -> bool;
}
 
#[test]
fn test_multi_contract_calls() {
    let caller = abi(CallerContract, CONTRACT_ID);
    let callee = abi(CalleeContract, callee::CONTRACT_ID);
 
    let should_be_false = caller.test_false();
    let should_be_true = callee.test_true();
    assert(!should_be_false);
    assert(should_be_true);
}

This script is completely unrelated from the contract above. Can we have a tutorial on how to test the contract above?

script;
 
fn main() {}
 
#[test]
fn test_fn() {
let a = 10;
    log(a);
    let b = 30;
    log(b);
    assert_eq(a, 10)
    assert_eq(b, 30)
}

Hi, take a look at how the Sway-Store contract is tested in the Sway for Javascript Devs guide.

Rust Testing | Fuel Docs

if you have time, it might be worthwhile to go through the entire guide.
Intro to Sway | Fuel Docs

Hi, do check out Sway | Fuel Docs where you can write test in the same file for unit test without Rust. My problem is writing Unit Test not Integration test.

Sure thanks, if you look further down there is a unit test inside a contract is this not the example you are looking for ?

Hi, what I meant was using a script file to test a contract. Using script allows to check the logs.