Skip to content

Add more unit tests #3

@GretaCB

Description

@GretaCB

Research how to add unit tests for React site: https://gatsby.dev/unit-testing

Also, look into solidifying the jest UI snapshot tests. I noticed they will unexpectedly fail on an updated class name, which I dont think should be the case.

> jest

 FAIL  src/components/__tests__/header.js
  Header
    ✕ renders correctly (48ms)

  ● Header › renders correctly

    expect(received).toMatchSnapshot()

    Snapshot name: `Header renders correctly 1`

    - Snapshot
    + Received

    @@ -1,7 +1,7 @@
      <header
    -   className="css-j8g5jg"
    +   className="css-1r8gbns"
      >
        <div
          className="css-1pgpot"
        >
          <h1>

       9 |       .create(<Header siteTitle="Carol Hansen" />)
      10 |       .toJSON()
    > 11 |     expect(tree).toMatchSnapshot()
         |                  ^
      12 |   })
      13 | })

      at Object.toMatchSnapshot (src/components/__tests__/header.js:11:18)

 › 1 snapshot failed.
Snapshot Summary
 › 1 snapshot failed from 1 test suite. Inspect your code changes or run `npm test -- -u` to update them.

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   1 failed, 1 total
  • Verify where these class ids come from, and check if these class Ids are "properties" that should be "asymmetrically matched".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions