FrontendMasters / intro-to-graphql

[Course] Introduction to GraphQL
190 stars 289 forks source link

Lesson 2: "Product has base fields" test is flawed #10

Open nmampersand opened 4 years ago

nmampersand commented 4 years ago

Test "Product has base fields" tests only that the included fields are the right type and not that all required fields are present. Due to this, the test will still pass even though the Product schema is missing some fields like description or createdBy.

type Product { name: String! price: Float! image: String! type: ProductType! range: String liquidCooled: Boolean bikeType: BikeType } ...

RUNS src/types/product/tests/product.type.spec.js PASS src/types/product/tests/product.type.spec.jsec.js Product schema lesson-2: ✓ Product has base fields (366ms) ✓ NewProductInput has correct fields (15ms) ✓ UpdateProductInput has correct fields (10ms) ✓ product query (45ms) ✓ products query (18ms) ✓ newProduct mutation (22ms) ✓ updateProduct mutation (19ms) ✓ removeProduct mutation (15ms)

nmampersand commented 4 years ago

Planning to open a PR shortly with a suggested fix.