adjust tests

This commit is contained in:
Moritz Bischof
2021-05-02 02:56:34 +02:00
parent 370cee753f
commit 49413b0678
7 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ pub(crate) fn unit(name: &str, rename_all: &Option<Inflection>) -> Result<Derive
Ok(DerivedTS {
inline: quote!("null".to_owned()),
decl: quote!(format!("export type {} = null;", #name)),
decl: quote!(format!("type {} = null;", #name)),
inline_flattened: None,
name: name.to_owned(),
dependencies: quote!(vec![]),
+2 -2
View File
@@ -20,7 +20,7 @@ fn test_newtype() {
#[derive(TS)]
struct NewType(String);
assert_eq!("export type NewType = string;", NewType::decl());
assert_eq!("type NewType = string;", NewType::decl());
}
#[test]
@@ -28,7 +28,7 @@ fn test_tuple_newtype() {
#[derive(TS)]
struct TupleNewType(String, i32, (i32, i32));
assert_eq!(
"export type TupleNewType = [string, number, [number, number]];",
"type TupleNewType = [string, number, [number, number]];",
TupleNewType::decl()
)
}
+1 -1
View File
@@ -14,6 +14,6 @@ enum SimpleEnum {
fn test_simple_enum() {
assert_eq!(
SimpleEnum::decl(),
r#"export type SimpleEnum = "asdf" | "B" | "C";"#
r#"type SimpleEnum = "asdf" | "B" | "C";"#
)
}
+1 -1
View File
@@ -16,6 +16,6 @@ enum RenamedEnum {
fn test_simple_enum() {
assert_eq!(
RenamedEnum::decl(),
r#"export type SimpleEnum = "ASDF" | "b" | "c";"#
r#"type SimpleEnum = "ASDF" | "b" | "c";"#
)
}
+3 -3
View File
@@ -31,11 +31,11 @@ enum Untagged {
fn test_serde_enum() {
assert_eq!(
SimpleEnum::decl(),
r#"export type SimpleEnum = {kind: "A", d: null} | {kind: "B", d: null};"#
r#"type SimpleEnum = {kind: "A", d: null} | {kind: "B", d: null};"#
);
assert_eq!(
ComplexEnum::decl(),
r#"export type ComplexEnum = {kind: "A", data: null} | {kind: "B", data: {
r#"type ComplexEnum = {kind: "A", data: null} | {kind: "B", data: {
foo: string,
bar: number,
}} | {kind: "W", data: SimpleEnum} | {kind: "F", data: {
@@ -45,6 +45,6 @@ fn test_serde_enum() {
assert_eq!(
Untagged::decl(),
r#"export type Untagged = string | number | null;"#
r#"type Untagged = string | number | null;"#
)
}
+2 -2
View File
@@ -26,13 +26,13 @@ enum SimpleEnum {
fn test_stateful_enum() {
assert_eq!(
Foo::decl(),
r#"export interface Foo {
r#"interface Foo {
bar: Bar,
}"#
);
assert_eq!(
SimpleEnum::decl(),
r#"export type SimpleEnum = string | number | "C" | [string, number] | Foo | {
r#"type SimpleEnum = string | number | "C" | [string, number] | Foo | {
a: number,
b: string,
};"#
+1 -1
View File
@@ -5,5 +5,5 @@ struct Unit;
#[test]
fn test() {
assert_eq!("export type Unit = null;", Unit::decl())
assert_eq!("type Unit = null;", Unit::decl())
}