Skip to content

Instantly share code, notes, and snippets.

@thehappydinoa
Created April 19, 2018 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thehappydinoa/93325959cfb8c6200f13f862fdc6a8d8 to your computer and use it in GitHub Desktop.
Save thehappydinoa/93325959cfb8c6200f13f862fdc6a8d8 to your computer and use it in GitHub Desktop.

After doing much reseach it seems that there is a gap between Python's datetime.datetime() and Javascript's thisHourUTC()

root@aidans-laptop:~/Desktop/intern-code-test# yarn test
yarn run v1.6.0
warning package.json: No license field
$ ava test/*-test.js

  3 passed
  3 failed

  POST /items

  /root/Desktop/intern-code-test/test/endpoint-test.js:104

   103:   const itemIsInDB = await db.one('SELECT * FROM items WHERE id=$1', itemData.id)
   104:   t.deepEqual(serializeItem(itemIsInDB), itemData)                               
   105: })                                                                               

  Difference:

    {
      categoryId: 2,
  -   createdAt: '2018-04-19T02:26:40.108Z',
  +   createdAt: '2018-04-19T02:26:40.108268+00:00',
      id: 5,
      title: 'Some new title here',
  -   updatedAt: '2018-04-19T02:26:40.108Z',
  +   updatedAt: '2018-04-19T02:26:40.108268+00:00',
    }



  GET /items/:item_id

  /root/Desktop/intern-code-test/test/endpoint-test.js:85

   84:   t.is(res.status, 200)                  
   85:   t.deepEqual(res.data.item, createdItem)
   86:   validateDates(t, res.data.item)        

  Difference:

    {
      categoryId: 1,
  -   createdAt: '2018-04-19T02:26:40.107133+00:00',
  +   createdAt: '2018-04-19T02:26:40.107Z',
      id: 2,
      title: 'some title',
  -   updatedAt: '2018-04-19T02:26:40.107133+00:00',
  +   updatedAt: '2018-04-19T02:26:40.107Z',
    }



  GET /items

  /root/Desktop/intern-code-test/test/endpoint-test.js:74

   73:   t.is(results.length, 2)       
   74:   t.deepEqual(results[0], item1)
   75:   t.deepEqual(results[1], item2)

  Difference:

    {
      categoryId: 1,
  -   createdAt: '2018-04-19T02:26:40.105015+00:00',
  +   createdAt: '2018-04-19T02:26:40.105Z',
      id: 1,
      title: 'some title',
  -   updatedAt: '2018-04-19T02:26:40.105015+00:00',
  +   updatedAt: '2018-04-19T02:26:40.105Z',
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment