joshuahoover / botkit-storage-dynamodb

A DynamoDB storage module for Botkit.
MIT License
2 stars 6 forks source link

Are tests working ok? #1

Closed andrewmacgregor closed 6 years ago

andrewmacgregor commented 8 years ago

I might just be doing something stupid but I can't get tests to pass on this project. Are they working ok for you?

→ npm test

> botkit-storage-dynamodb@0.0.4 pretest /Users/andrew/Personal/git-devel/botkit-storage-dynamodb
> jscs ./

> botkit-storage-dynamodb@0.0.4 test /Users/andrew/Personal/git-devel/botkit-storage-dynamodb
> istanbul cover --report lcov --dir coverage/ _mocha ./tests --grep ./tests/*.js -- --colors

  Dynamo
    Initialization
      1) should throw an error if config is missing
      2) should throw an error if dynamoRegion is missing
      3) should throw an error if dynamoAccessKey is missing
      4) should throw an error if dynamoAccessSecret is missing
      ✓ should initialize dynasty with dynamoRegion, dynamoAccessKey, dynamoAccessSecret
    teams.get
      5) should call find with callback
    teams.save
      6) should call update
    teams.all
      7) should call findAll
    channels.get
      8) should call find with callback
    channels.save
      9) should call update
    channels.all
      10) should call findAll
    users.get
      11) should call find with callback
    users.save
      12) should call update
    users.all
      13) should call findAll

  1 passing (175ms)
  13 failing

  1) Dynamo Initialization should throw an error if config is missing:
     AssertionError: expected Function {
  name: '(config){__cov_wBJJ_XJenSJcZMEPIh8EXg.f[\'1\']++;__cov_wBJJ_XJenSJcZMEPIh8EXg.s[\'2\']++;if((__cov_wBJJ_XJenSJcZMEPIh8EXg.b[\'2\'][0]++,!config)||(__cov_wBJJ_XJenSJcZMEPIh8EXg.b[\'2\'][1]++,!config.dynamoRegion)||(__cov_wBJJ_XJenSJcZMEPIh8EXg.b[\'2\'][2]++,!config.dynamoAccessKey)||'
} to throw exception with a message matching 'Need to provide dynamo dynamoRegion, dynamoAccessKey, dynamoAccessSecret', but got 'Need to provide dynamoRegion, dynamoAccessKey, dynamoAccessSecret'
      at Assertion.fail (node_modules/should/lib/assertion.js:92:17)
      at Assertion.Object.defineProperty.value (node_modules/should/lib/assertion.js:164:19)
      at Context.<anonymous> (tests/index.js:36:33)

  2) Dynamo Initialization should throw an error if dynamoRegion is missing:
     AssertionError: expected Function { name: '' } to throw exception with a message matching 'Need to provide dynamo dynamoRegion, dynamoAccessKey, dynamoAccessSecret', but got 'Need to provide dynamoRegion, dynamoAccessKey, dynamoAccessSecret'
      at Assertion.fail (node_modules/should/lib/assertion.js:92:17)
      at Assertion.Object.defineProperty.value (node_modules/should/lib/assertion.js:164:19)
      at Context.<anonymous> (tests/index.js:42:57)

  3) Dynamo Initialization should throw an error if dynamoAccessKey is missing:
     AssertionError: expected Function { name: '' } to throw exception with a message matching 'Need to provide dynamo dynamoRegion, dynamoAccessKey, dynamoAccessSecret', but got 'Need to provide dynamoRegion, dynamoAccessKey, dynamoAccessSecret'
      at Assertion.fail (node_modules/should/lib/assertion.js:92:17)
      at Assertion.Object.defineProperty.value (node_modules/should/lib/assertion.js:164:19)
      at Context.<anonymous> (tests/index.js:48:57)

  4) Dynamo Initialization should throw an error if dynamoAccessSecret is missing:
     AssertionError: expected Function { name: '' } to throw exception with a message matching 'Need to provide dynamo dynamoRegion, dynamoAccessKey, dynamoAccessSecret', but got 'Need to provide dynamoRegion, dynamoAccessKey, dynamoAccessSecret'
      at Assertion.fail (node_modules/should/lib/assertion.js:92:17)
      at Assertion.Object.defineProperty.value (node_modules/should/lib/assertion.js:164:19)
      at Context.<anonymous> (tests/index.js:54:57)

  5) Dynamo teams.get should call find with callback:
     TypeError: Cannot read property 'then' of undefined
      at Object.get (src/index.js:9:1609)
      at Context.<anonymous> (tests/index.js:74:41)

  6) Dynamo teams.save should call update:
     TypeError: Cannot read property 'then' of undefined
      at Object.save (src/index.js:9:2370)
      at Context.<anonymous> (tests/index.js:84:41)

  7) Dynamo teams.all should call findAll:
     TypeError: Cannot read property 'then' of undefined
      at Object.all (src/index.js:9:2850)
      at Context.<anonymous> (tests/index.js:96:41)

  8) Dynamo channels.get should call find with callback:
     TypeError: Cannot read property 'then' of undefined
      at Object.get (src/index.js:9:1609)
      at Context.<anonymous> (tests/index.js:74:41)

  9) Dynamo channels.save should call update:
     TypeError: Cannot read property 'then' of undefined
      at Object.save (src/index.js:9:2370)
      at Context.<anonymous> (tests/index.js:84:41)

  10) Dynamo channels.all should call findAll:
     TypeError: Cannot read property 'then' of undefined
      at Object.all (src/index.js:9:2850)
      at Context.<anonymous> (tests/index.js:96:41)

  11) Dynamo users.get should call find with callback:
     TypeError: Cannot read property 'then' of undefined
      at Object.get (src/index.js:9:1609)
      at Context.<anonymous> (tests/index.js:74:41)

  12) Dynamo users.save should call update:
     TypeError: Cannot read property 'then' of undefined
      at Object.save (src/index.js:9:2370)
      at Context.<anonymous> (tests/index.js:84:41)

  13) Dynamo users.all should call findAll:
     TypeError: Cannot read property 'then' of undefined
      at Object.all (src/index.js:9:2850)
      at Context.<anonymous> (tests/index.js:96:41)

=============================================================================
Writing coverage object [/Users/andrew/Personal/git-devel/botkit-storage-dynamodb/coverage/coverage.json]
Writing coverage reports at [/Users/andrew/Personal/git-devel/botkit-storage-dynamodb/coverage]
=============================================================================

=============================== Coverage summary ===============================
Statements   : 63.33% ( 19/30 )
Branches     : 50% ( 8/16 )
Functions    : 53.85% ( 7/13 )
Lines        : 63.33% ( 19/30 )
================================================================================
npm ERR! Test failed.  See above for more details.
joshuahoover commented 7 years ago

Sorry Andrew. I was away for a while and unable to answer emails, etc. I just saw this notification.

Tests don't pass because I'm not sure how to test JavaScript Promises. If you do or someone you know does and would like to make these tests pass, please do. :-)

miklosaubert commented 6 years ago

Looks to me like this issue could finally be closed :)

joshuahoover commented 6 years ago

Latest PR fixes the tests. Thanks to @miklosaubert :-)