Skip to content

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

@nmampersand

Description

@nmampersand

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)

Activity

changed the title [-]Lesson 2: "Product has base fields" doesn[/-] [+]Lesson 2: "Product has base fields" test is flawed[/+] on Nov 4, 2019
nmampersand

nmampersand commented on Nov 4, 2019

@nmampersand
Author

Planning to open a PR shortly with a suggested fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @nmampersand

        Issue actions

          Lesson 2: "Product has base fields" test is flawed · Issue #10 · FrontendMasters/intro-to-graphql