Skip to content

Commit

Permalink
Test case for array Json param
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleyayers committed May 22, 2021
1 parent 2f7f91e commit 7164361
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/example/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ async function main() {
},
client,
);
await insertNotification.run(
{
notification: {
user_id: 1,
payload: [{ num_frogs: 1002 }],
type: 'reminder',
},
},
client,
);

const notifications = await thresholdFrogs.run({ numFrogs: 80 }, client);

Expand Down

1 comment on commit 7164361

@bradleyayers
Copy link
Contributor Author

@bradleyayers bradleyayers commented on 7164361 May 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integration tests fail:

npm run test:integration

> pgtyped@0.0.1 test:integration /Users/brad/src/pgtyped
> cd packages/example && docker-compose run test

Starting example_build_1 ... done
Creating example_test_run ... done
Checking postgres is up...
Comments: [{"id":1,"user_id":1,"book_id":1,"body":"Fantastic read, recommend it!"},{"id":2,"user_id":1,"book_id":2,"body":"Did not like it, expected much more..."}]
Inserted book ID: 7
Book: {"id":2,"rank":13,"name":"Another title","author_id":2}
Error running example code: error: invalid input syntax for type json
    at Parser.parseErrorMessage (/app/packages/example/node_modules/pg-protocol/src/parser.ts:369:69)
    at Parser.handlePacket (/app/packages/example/node_modules/pg-protocol/src/parser.ts:188:21)
    at Parser.parse (/app/packages/example/node_modules/pg-protocol/src/parser.ts:103:30)
    at Socket.<anonymous> (/app/packages/example/node_modules/pg-protocol/src/index.ts:7:48)
    at Socket.emit (node:events:365:28)
    at Socket.emit (node:domain:470:12)
    at addChunk (node:internal/streams/readable:314:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

Please sign in to comment.