georgiakirkpatrick / veronaut-products-api

Fashion sustainability research, but make it shopping.
0 stars 0 forks source link

Solve hanging tests #6

Open georgiakirkpatrick opened 2 years ago

georgiakirkpatrick commented 2 years ago

Certifictions POST /api/certifications/

Problem seems to be in test rather than router.

Look here for problem: .then(res => { console.log('res.body', res.body) supertest(app) .get(/api/certifications/${res.body.id}) .expect(200, newCertification) .catch(error => { console.log('error', error) }) })

georgiakirkpatrick commented 2 years ago

describe('POST /api/fabrics', () => {

Problem seems to be in test rather than router.

Look here for problem: .then(res => { console.log('res.body.id', res.body.id) supertest(app) .get(/api/fabrics/${res.body.id}) .expect(200, newFabric) .catch(error => { console.log('error', error) }) })

georgiakirkpatrick commented 2 years ago

describe('POST /api/notions', () => { Problem seems to be in test rather than router.

Look here for problem: .then(postRes => { supertest(app) .get(/api/notions/${postRes.body.id}) .expect(postRes.body) .catch(error => { console.log('error', error) }) }) })

georgiakirkpatrick commented 2 years ago

describe('POST /api/products', () => { Problem seems to be in test rather than router.

Look here for problem: .then(postRes => { supertest(app) .get(/api/products/${postRes.body.id}) .expect(postRes.body) .catch(error => { console.log('error', error) }) })

georgiakirkpatrick commented 2 years ago

describe('POST /api/products/product-form', () => { Problem seems to be in test rather than router.

Look here for problem: .then(postRes => { supertest(app) .get(/api/products/${postRes.body.id}) .catch(error => { console.log('error', error) }) })

georgiakirkpatrick commented 2 years ago

describe('POST /api/products/${productId}/colors', () => { Problem seems to be in test rather than router.

Look here for problem: .then(res => { supertest(app) .get(/api/products/${res.body.id}/colors) .expect(res.body) .catch(error => { console.log('error', error) }) })

georgiakirkpatrick commented 2 years ago

describe('PATCH /api/products/:product_id', () => { Problem seems to be in test rather than router.

Look here for problem: .then(res => { supertest(app) .get(/api/products/${idToUpdate}) .expect(expectedProduct) .catch(error => { console.log('error', error) }) })

georgiakirkpatrick commented 2 years ago

describe('POST /api/users', () => {

beforeEach(() => db.into('users').insert(users))

getting error: insert into "users" ("account_created", "bio", "email", "handle", "id", "name", "password", "profile_pic", "public", "website") values (DEFAULT, $1, $2, $3, DEFAULT, $4, $5, $6, DEFAULT, $7) returning * - duplicate key value violates unique constraint "users_pkey"

georgiakirkpatrick commented 2 years ago

describe('PATCH /api/users/:user_id', () => {

Problem seems to be in test rather than router. res.body { error: 'Unauthorized request' } error AssertionError: expected undefined to deeply equal 'new@email.com'

georgiakirkpatrick commented 2 years ago

describe('POST /api/fibers', () => {

Problem seems to be in test rather than router.

Problem is here: .then(res => { supertest(app) .get(/api/fibers/${res.body.id}) .expect(res.body) .catch(error => { console.log('error', error) }) })

Getting this error: error Error: expected { id: 1, fiber_type_id: 1, brand_id: 1, producer_country: 1, producer_id: 1, production_notes: 'Notes', approved_by_admin: false, date_published: '2021-12-02T19:00:08.943Z' } response body, got { error: { message: 'Fiber does not exist' } }