在 Postman 上 JSON 中测试一个大的 body 响应

Test a big body response in JSON on Postman

我在 Postman 上收到了 body 回复,return 这对我来说:

[
{
    "key": "Dateline Standard Time",
    "value": "(UTC-12:00) International Date Line West"
},
{
    "key": "UTC-11",
    "value": "(UTC-11:00) Coordinated Universal Time-11"
},
{
    "key": "Aleutian Standard Time",
    "value": "(UTC-10:00) Aleutian Islands"
}]

那么,在“测试”选项卡中,我应该写什么来测试响应是否完全符合相同的顺序?

我试过这样的事情:

    pm.test("Body is correct", function(){
      pm.response.to.have.body("
     [
    {
        "key": "Dateline Standard Time",
        "value": "(UTC-12:00) International Date Line West"
    },
    {
        "key": "UTC-11",
        "value": "(UTC-11:00) Coordinated Universal Time-11"
    },
    {
        "key": "Aleutian Standard Time",
        "value": "(UTC-10:00) Aleutian Islands"
    }]
    ");

但还是不行。

谢谢!

pm.test("Body is correct", function () {
    pm.expect(pm.response.json()).to.deep.equal(
        [
            {
                "key": "Dateline Standard Time",
                "value": "(UTC-12:00) International Date Line West"
            },
            {
                "key": "UTC-11",
                "value": "(UTC-11:00) Coordinated Universal Time-11"
            },
            {
                "key": "Aleutian Standard Time",
                "value": "(UTC-10:00) Aleutian Islands"
            }]
    )
});

使用深度相等