product tests fix

Vic
Vic 2 years ago
parent 685eba0b57
commit 045071d1e9

@ -9,7 +9,7 @@
"test": {
"driver": "pg",
"host": "127.0.0.1",
"database": "shelf-test",
"database": "shelf_test",
"user": "postgres",
"password": "fredy123"
}

@ -60,7 +60,7 @@ export class ProductStore {
try {
const conn = await client.connect();
const result = await conn.query(
'UPDATE products SET name=$1, price=$2 WHERE id=$3 returning *;',
'UPDATE products SET name=$1, price=$2 WHERE id=$3 RETURNING *;',
[p.name, p.price, p.id]
);
conn.release()
@ -72,7 +72,7 @@ export class ProductStore {
async delete(id: number): Promise<Product> {
try {
const sql = 'DELETE FROM products WHERE id=(1$)'
const sql = 'DELETE FROM products WHERE id=($1)'
// @ts-ignore
const conn = await client.connect()

@ -33,7 +33,7 @@ describe("Products store Model", () => {
});
});
/*it('index method should return a list of products', async () => {
it('index method should return a list of products', async () => {
const result = await store.index();
expect(result).toEqual([{
id: 1,
@ -57,6 +57,6 @@ describe("Products store Model", () => {
const result = await store.index()
expect(result).toEqual([]);
});*/
});
});

Loading…
Cancel
Save