forked from adelsz/pgtyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move unit tests to integration tests instead
- Loading branch information
Showing
4 changed files
with
199 additions
and
329 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,3 @@ | ||
import { parseCode } from './parseRescript.js'; | ||
|
||
test('parser finds string template in correct file', () => { | ||
const fileContent = ` | ||
let query = %sql.one(\` | ||
/* @name FindBookById */ | ||
SELECT * FROM books WHERE id = :id; | ||
\`); | ||
`; | ||
|
||
const result = parseCode(fileContent); | ||
expect(result).toMatchSnapshot(); | ||
}); | ||
|
||
test('inserts trailing semicolon when needed', () => { | ||
const fileContent = ` | ||
let query = %sql.one(\` | ||
/* @name FindBookById */ | ||
SELECT * FROM books WHERE id = :id | ||
\`); | ||
let queryMany = %sql.many(\` | ||
/* @name FindBooks */ | ||
SELECT * FROM books | ||
\`); | ||
`; | ||
|
||
const result = parseCode(fileContent); | ||
expect(result).toMatchSnapshot(); | ||
}); | ||
|
||
test('inserts @name when needed', () => { | ||
const fileContent = ` | ||
let query = %sql.one(\` | ||
/* @name FindBookById */ | ||
SELECT * FROM books WHERE id = :id | ||
\`); | ||
let queryMany = %sql.many(\` | ||
SELECT * FROM books | ||
\`); | ||
let queryExpect = %sql.expectOne(\` | ||
SELECT * FROM books WHERE id = :id | ||
\`); | ||
`; | ||
|
||
const result = parseCode(fileContent); | ||
expect(result).toMatchSnapshot(); | ||
}); | ||
|
||
test('preserves @param when inserting @name', () => { | ||
const fileContent = ` | ||
let query = %sql.one(\` | ||
/* | ||
@param notification -> (payload, user_id, type) | ||
*/ | ||
INSERT INTO notifications (payload, user_id, type) VALUES :notification | ||
\`); | ||
`; | ||
|
||
const result = parseCode(fileContent); | ||
expect(result).toMatchSnapshot(); | ||
test('test', () => { | ||
expect(true).toBe(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.