Skip to content

Commit 8add309

Browse files
committed
tests/publish/dependencies: Add invalid_dependency_name() test
1 parent 65a026e commit 8add309

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/tests/krate/publish/dependencies.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ use crate::util::{RequestHelper, TestApp};
33
use http::StatusCode;
44
use insta::assert_json_snapshot;
55

6+
#[test]
7+
fn invalid_dependency_name() {
8+
let (app, _, _, token) = TestApp::full().with_token();
9+
10+
let response = token.publish_crate(
11+
PublishBuilder::new("foo", "1.0.0").dependency(DependencyBuilder::new("🦀")),
12+
);
13+
assert_eq!(response.status(), StatusCode::OK);
14+
assert_json_snapshot!(response.into_json());
15+
assert!(app.stored_files().is_empty());
16+
}
17+
618
#[test]
719
fn new_with_renamed_dependency() {
820
let (app, _, user, token) = TestApp::full().with_token();
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
source: src/tests/krate/publish/dependencies.rs
3+
expression: response.into_json()
4+
---
5+
{
6+
"errors": [
7+
{
8+
"detail": "invalid upload request: invalid value: string \"🦀\", expected a valid crate name to start with a letter, contain only letters, numbers, hyphens, or underscores and have at most 64 characters at line 1 column 92"
9+
}
10+
]
11+
}

0 commit comments

Comments
 (0)