()
| 136 | |
| 137 | #[test] |
| 138 | fn should_handle_insert_with_params() -> Result<(), Box<dyn std::error::Error>> { |
| 139 | let schema = "CREATE TABLE items (id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL, price REAL);"; |
| 140 | |
| 141 | let ts_content = r#" |
| 142 | import { sql } from 'sqlx-ts' |
| 143 | |
| 144 | const someQuery = sql`INSERT INTO items (name, price) VALUES (?, ?)` |
| 145 | "#; |
| 146 | |
| 147 | let (_, type_file) = run_sqlite_test(schema, ts_content, true)?; |
| 148 | |
| 149 | let expected = r#" |
| 150 | export type SomeQueryParams = [[string, number | null]]; |
| 151 | |
| 152 | export interface ISomeQueryResult { |
| 153 | } |
| 154 | |
| 155 | export interface ISomeQueryQuery { |
| 156 | params: SomeQueryParams; |
| 157 | result: ISomeQueryResult; |
| 158 | } |
| 159 | "#; |
| 160 | |
| 161 | assert_eq!( |
| 162 | expected.trim().to_string().flatten(), |
| 163 | type_file.trim().to_string().flatten() |
| 164 | ); |
| 165 | Ok(()) |
| 166 | } |
| 167 | |
| 168 | #[test] |
| 169 | fn should_handle_multiple_types() -> Result<(), Box<dyn std::error::Error>> { |
nothing calls this directly
no test coverage detected