Skip to content

Commit

Permalink
adapt metagen tests to the new changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Natoandro committed Oct 30, 2024
1 parent c26b710 commit 0e4f78b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
11 changes: 8 additions & 3 deletions src/metagen/fixtures/client_rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ package.edition = "2021"
package.version = "0.0.1"

[dependencies]
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.117"
serde = { version = "1.0.210", features = ["derive"] }
serde_json = "1.0.128"
reqwest = { version = "0.12", features = ["blocking","json", "stream", "multipart"] }
mime_guess = "2.0"
futures = "0.3"
tokio-util = { version = "0.7", features = ["compat", "io"] }
derive_more = { version = "1.0", features = ["debug"] }
lazy_static = "1.5"
tokio = { version = "1", features = ["rt-multi-thread"] }
reqwest = { version = "0.12", features = ["blocking","json"] }

[workspace]
resolver = "2"
Expand Down
3 changes: 2 additions & 1 deletion src/metagen/fixtures/tg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ typegraph({
int: t.integer(),
float: t.float(),
boolean: t.boolean(),
file: t.file(),
// FIXME file upload for FDK
// file: t.file(),
opt: t.optional(t.string()),
either: t.either([
t.struct({ a: t.string() }),
Expand Down
12 changes: 4 additions & 8 deletions src/metagen/src/client_rs/static/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,7 @@ impl std::error::Error for SelectionError {}
pub struct TypePath(&'static [&'static str]);

fn path_segment_as_prop(segment: &str) -> Option<&str> {
if segment.starts_with('.') {
Some(&segment[1..])
} else {
None
}
segment.strip_prefix('.')
}

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -312,7 +308,7 @@ impl TryFrom<FileId> for File {

fn try_from(file_id: FileId) -> Result<Self, Self::Error> {
let mut guard = FILE_STORE.lock().map_err(|_| "file store lock poisoned")?;
let file = guard.remove(&file_id).ok_or_else(|| "file not found")?;
let file = guard.remove(&file_id).ok_or("file not found")?;
if file.file_name.is_none() {
Ok(file.file_name(file_id.0.to_string()))
} else {
Expand Down Expand Up @@ -1761,7 +1757,7 @@ pub mod graphql {

// TODO rename files

if files.len() > 0 {
if !files.is_empty() {
// multipart
let mut form = Form::new();

Expand Down Expand Up @@ -1828,7 +1824,7 @@ pub mod graphql {
"variables": variables
});

if files.len() > 0 {
if !files.is_empty() {
// multipart
let mut form = Form::new();

Expand Down
1 change: 1 addition & 0 deletions src/metagen/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ async fn load_fdk_template(
Ok(FdkTemplate { entries })
}

#[derive(Debug)]
pub struct BuildArgs {
pub path: PathBuf,
}
Expand Down
3 changes: 2 additions & 1 deletion tools/tasks/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export default {
--exclude typegate
--exclude typegate_engine
--exclude typegraph_core
--exclude metagen_fdk_rust_static`;
--exclude metagen_fdk_rust_static
--exclude client_rs_static`;
// typegraph_core tests need to be run separately
// without --tests, the --doc is causing a link error "syntax error in VERSION script"
await $`cargo test --locked --package typegraph_core --tests`;
Expand Down

0 comments on commit 0e4f78b

Please sign in to comment.