mizdra / happy-css-modules

Typed, definition jumpable CSS Modules. Moreover, easy!
MIT License
225 stars 5 forks source link

Refactor test with custom snapshot serializer #57

Closed mizdra closed 2 years ago

mizdra commented 2 years ago

Before

expect(result).toMatchInlineSnapshot(`
  Object {
    "dependencies": Array [],
    "tokens": Array [
      Object {
        "name": "a",
        "originalLocations": Array [
          Object {
            "end": Object {
              "column": 2,
              "line": 1,
            },
            "filePath": "/test/1.css",
            "start": Object {
              "column": 1,
              "line": 1,
            },
          },
        ],
      },
      Object {
        "name": "b",
        "originalLocations": Array [
          Object {
            "end": Object {
              "column": 2,
              "line": 2,
            },
            "filePath": "/test/1.css",
            "start": Object {
              "column": 1,
              "line": 2,
            },
          },
        ],
      },
    ],
  }
`);

After

expect(result).toMatchInlineSnapshot(`
  {
    "dependencies": [],
    "tokens": [
      {
        "name": "a",
        "originalLocations": [
          { "filePath": "/test/1.css", "start": { "line": 1, "column": 1 }, "end": { "line": 1, "column": 2 } }
        ]
      },
      {
        "name": "b",
        "originalLocations": [
          { "filePath": "/test/1.css", "start": { "line": 2, "column": 1 }, "end": { "line": 2, "column": 2 } }
        ]
      }
    ]
  }
`);