Javascript 如何处理带有日期的快照测试对象的场景?

Javascript 如何处理带有日期的快照测试对象的场景?,javascript,reactjs,jestjs,Javascript,Reactjs,Jestjs,我有一个快照测试: test("Confirm renders", () => { const { toJSON } = render( <Confirm terms={true} payment={[]} onAccept={jest.fn()} amount={10} limit={500} store={{ isInNetwork: false }} na

我有一个快照测试:

test("Confirm renders", () => {
  const { toJSON } = render(
    <Confirm
      terms={true}
      payment={[]}
      onAccept={jest.fn()}
      amount={10}
      limit={500}
      store={{
        isInNetwork: false
      }}
      navigation={navMock}
    />
  );
  expect(toJSON()).toMatchSnapshot();
});
正确的精确日期检查是无关紧要的,我只需要检查是否返回了日期。那么,在这种情况下,我应该如何正确设置快照测试?如何使用带日期的快照测试

可能的重复可能的重复
  "color": "#13131F",
                      },
                    ]
                  }
                >
-                 Oct 31
+                 Nov 06
                </Text>
              </View>
            </View>
          </View>
        </View>

       />
     );
   expect(toJSON()).toMatchSnapshot();
                       ^
  });
const order = {
      merchant: {
        tradingName: store.name
      },
      payments: [
        {
          id: 1,
          paymentStatus: 3,
          date: moment(),
          amount: amount / 4
        },
        {
          id: 2,
          paymentStatus: 0,
          date: moment().add(2, "weeks"),
          amount: amount / 4
        },
        {
          id: 3,
          paymentStatus: 0,
          date: moment().add(4, "weeks"),
          amount: amount / 4
        },
        {
          id: 4,
          paymentStatus: 0,
          date: moment().add(6, "weeks"),
          amount: amount / 4
        }
      ]
    };