Skip to content

Commit

Permalink
test(add): add some test case to test codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
phnaharris committed Dec 17, 2023
1 parent e24d109 commit 1854f49
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
File renamed without changes.
19 changes: 19 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ on:
branches: [main]
name: main
jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test

codecov:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 3 additions & 0 deletions src/api/bridging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ impl BridgeResponse {
self.approve_to
}
}

#[cfg(test)]
mod tests {}
20 changes: 20 additions & 0 deletions src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,23 @@ pub enum SymbiosisTradeType {
/// Izumi
Izumi,
}

#[cfg(test)]
mod tests {
use super::SymbiosisTradeType;

#[test]
fn token_types_as_str() {
let items = &[
(SymbiosisTradeType::Dex, "\"dex\""),
(SymbiosisTradeType::OneInch, "\"1inch\""),
(SymbiosisTradeType::OpenOcean, "\"open-ocean\""),
(SymbiosisTradeType::Wrap, "\"wrap\""),
(SymbiosisTradeType::Izumi, "\"izumi\""),
];

for (i, s) in items {
assert_eq!(serde_json::to_string(i).unwrap(), *s);
}
}
}
14 changes: 14 additions & 0 deletions src/types/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,17 @@ pub enum TokenTypes {
/// TRC20 token.
Tron,
}

#[cfg(test)]
mod tests {
use super::TokenTypes;

#[test]
fn token_types_as_str() {
let items = &[(TokenTypes::Evm, "\"evm\""), (TokenTypes::Tron, "\"tron\"")];

for (i, s) in items {
assert_eq!(serde_json::to_string(i).unwrap(), *s);
}
}
}

0 comments on commit 1854f49

Please sign in to comment.