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 7bc322b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,25 @@ on:
branches: [main]
name: main
jobs:
codecov:
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

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
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 7bc322b

Please sign in to comment.