()
| 68 | |
| 69 | #[test] |
| 70 | fn should_validate_simple_select() -> Result<(), Box<dyn std::error::Error>> { |
| 71 | let schema = "CREATE TABLE items (id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL, price REAL);"; |
| 72 | |
| 73 | let ts_content = r#" |
| 74 | import { sql } from 'sqlx-ts' |
| 75 | |
| 76 | const someQuery = sql`SELECT * FROM items` |
| 77 | "#; |
| 78 | |
| 79 | let (_, type_file) = run_sqlite_test(schema, ts_content, true)?; |
| 80 | |
| 81 | let expected = r#" |
| 82 | export type SomeQueryParams = []; |
| 83 | |
| 84 | export interface ISomeQueryResult { |
| 85 | id: number; |
| 86 | name: string; |
| 87 | price: number | null; |
| 88 | } |
| 89 | |
| 90 | export interface ISomeQueryQuery { |
| 91 | params: SomeQueryParams; |
| 92 | result: ISomeQueryResult; |
| 93 | } |
| 94 | "#; |
| 95 | |
| 96 | assert_eq!( |
| 97 | expected.trim().to_string().flatten(), |
| 98 | type_file.trim().to_string().flatten() |
| 99 | ); |
| 100 | Ok(()) |
| 101 | } |
| 102 | |
| 103 | #[test] |
| 104 | fn should_handle_query_params_with_question_mark() -> Result<(), Box<dyn std::error::Error>> { |
nothing calls this directly
no test coverage detected