Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavo-shigueo committed Feb 22, 2025
1 parent edf8d13 commit a157c0c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ts-rs/tests/integration/complex_flattened_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,22 @@ pub struct InputField {

#[test]
fn complex_flattened_type() {
let number_type = if cfg!(target_pointer_width = "64") {
"bigint"
} else {
"number"
};

assert_eq!(
InputFieldElement::decl(),
r#"type InputFieldElement = { "type": "Label", text: string, } | { "type": "Input", name: string | null, placeholder: string | null, default: string | null, } & ({ "input_type": "Text" } | { "input_type": "Expression" } | { "input_type": "Number", min: number | null, max: number | null, } | { "input_type": "Dropdown", options: Array<[string, string]>, });"#
format!(
r#"type InputFieldElement = {{ "type": "Label", text: string, }} | {{ "type": "Input", name: string | null, placeholder: string | null, default: string | null, }} & ({{ "input_type": "Text" }} | {{ "input_type": "Expression" }} | {{ "input_type": "Number", min: {number_type} | null, max: {number_type} | null, }} | {{ "input_type": "Dropdown", options: Array<[string, string]>, }});"#
)
);
assert_eq!(
InputField::decl(),
r#"type InputField = { "type": "Label", text: string, } | { "type": "Input", name: string | null, placeholder: string | null, default: string | null, } & ({ "input_type": "Text" } | { "input_type": "Expression" } | { "input_type": "Number", min: number | null, max: number | null, } | { "input_type": "Dropdown", options: Array<[string, string]>, });"#
format!(
r#"type InputField = {{ "type": "Label", text: string, }} | {{ "type": "Input", name: string | null, placeholder: string | null, default: string | null, }} & ({{ "input_type": "Text" }} | {{ "input_type": "Expression" }} | {{ "input_type": "Number", min: {number_type} | null, max: {number_type} | null, }} | {{ "input_type": "Dropdown", options: Array<[string, string]>, }});"#
)
)
}

0 comments on commit a157c0c

Please sign in to comment.