Skip to content

Commit

Permalink
Merge pull request #26 from jiahao6635/master
Browse files Browse the repository at this point in the history
repo description is changed to Option
  • Loading branch information
wangeguo authored Jan 18, 2024
2 parents 879abac + df407a2 commit 0abaa4c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/scm/driver/github/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct GithubRepository {
pub default_branch: String,
pub created_at: String,
pub updated_at: String,
pub description: String,
pub description: Option<String>,
}

#[derive(Debug, Deserialize, Serialize)]
Expand Down
2 changes: 1 addition & 1 deletion src/scm/driver/gitlab/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub struct GitlabRepository {
pub http_url: String,
pub namespace: GitlabNamespace,
pub created_at: String,
pub description: String,
pub description: Option<String>,
// pub updated_at: String,
}

Expand Down
2 changes: 1 addition & 1 deletion src/scm/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct Repository {
pub link: String,
pub created: String,
pub updated: String,
pub description: String,
pub description: Option<String>,
}

/// Provides access to repository resources.
Expand Down
7 changes: 5 additions & 2 deletions tests/scm/driver/github/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::common::mock;

const REPO: &str = "octocat/Hello-World";
const REFERENCE: &str = "master";
const DESCRIPTION: &str = "My first repository on GitHub!";
const DESCRIPTION: Option<&str> = Some("My first repository on GitHub!");

#[test]
fn test_find() {
Expand All @@ -36,5 +36,8 @@ fn test_find() {

let repo = result.unwrap().unwrap();
assert_eq!(repo.branch, REFERENCE.to_string());
assert_eq!(repo.description, DESCRIPTION.to_string());
assert_eq!(
repo.description.unwrap_or_default(),
DESCRIPTION.unwrap_or_default()
);
}
7 changes: 5 additions & 2 deletions tests/scm/driver/gitlab/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::common::mock;

const REPO: &str = "octocat/Hello-World";
const REFERENCE: &str = "master";
const DESCRIPTION: &str = "Repository used by GitLab CE/EE and Gitaly tests";
const DESCRIPTION: Option<&str> = Some("Repository used by GitLab CE/EE and Gitaly tests");

#[test]
fn test_find() {
Expand All @@ -36,5 +36,8 @@ fn test_find() {

let repo = result.unwrap().unwrap();
assert_eq!(repo.branch, REFERENCE.to_string());
assert_eq!(repo.description, DESCRIPTION.to_string());
assert_eq!(
repo.description.unwrap_or_default(),
DESCRIPTION.unwrap_or_default()
);
}

0 comments on commit 0abaa4c

Please sign in to comment.