From 4b4a92b62bb7cbe485fc0b90d17d67a8d1e9b10e Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Sun, 12 May 2019 22:46:21 -0700 Subject: [PATCH] chore: do not rely on test's key order --- test/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/index.js b/test/index.js index 6b3b8ec..5508423 100644 --- a/test/index.js +++ b/test/index.js @@ -24,9 +24,14 @@ test('exports', t => { }); test('GET (200)', async t => { - t.plan(6); + t.plan(8); let res = await httpie.get('https://reqres.in/api/users/2'); - isResponse(t, res, 200, {"data":{"id":2,"first_name":"Janet","last_name":"Weaver","avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg"}}); + isResponse(t, res, 200); + + let data = res.data; + t.ok(!!data.data, '~~> had "data" key'); + t.is(data.data.id, 2, '~~> had "data.id" value'); + t.is(data.data.first_name, 'Janet', '~~> had "data.first_name" value'); }); test('GET (404)', async t => {