Skip to content

Instantly share code, notes, and snippets.

@piontekle
Last active March 14, 2019 21:21
Show Gist options
  • Save piontekle/17eea090c981d281c7a1babb6609afcc to your computer and use it in GitHub Desktop.
Save piontekle/17eea090c981d281c7a1babb6609afcc to your computer and use it in GitHub Desktop.
Assignment 14 getPoints() undefined
Started
server is listening for requests on port 3000
.....VOTE:
Vote {
dataValues:
{ id: 1,
value: 1,
postId: 1,
userId: 1,
createdAt: 2019-03-14T21:20:25.302Z,
updatedAt: 2019-03-14T21:20:25.302Z },
_previousDataValues:
{ id: 1,
value: 1,
postId: 1,
userId: 1,
createdAt: 2019-03-14T21:20:25.302Z,
updatedAt: 2019-03-14T21:20:25.302Z },
_changed: {},
_modelOptions:
{ timestamps: true,
validate: {},
freezeTableName: false,
underscored: false,
underscoredAll: false,
paranoid: false,
rejectOnEmpty: false,
whereCollection: { postId: 1, userId: 1 },
schema: null,
schemaDelimiter: '',
defaultScope: {},
scopes: [],
indexes: [],
name: { plural: 'Votes', singular: 'Vote' },
omitNull: false,
sequelize:
Sequelize {
options: [Object],
config: [Object],
dialect: [PostgresDialect],
queryInterface: [QueryInterface],
models: [Object],
modelManager: [ModelManager],
connectionManager: [ConnectionManager],
importCache: [Object],
test: [Object] },
hooks: {},
uniqueKeys: {} },
_options:
{ isNewRecord: false,
_schema: null,
_schemaDelimiter: '',
raw: true,
attributes:
[ 'id', 'value', 'postId', 'userId', 'createdAt', 'updatedAt' ] },
__eagerlyLoadedAssociations: [],
isNewRecord: false }
------------
FOUND POST:
Post {
dataValues:
{ id: 1,
title: 'My first visit to Proxima Centauri b',
body: 'I saw some rocks.',
topicId: 1,
userId: 1,
createdAt: 2019-03-14T21:20:25.287Z,
updatedAt: 2019-03-14T21:20:25.287Z },
_previousDataValues:
{ id: 1,
title: 'My first visit to Proxima Centauri b',
body: 'I saw some rocks.',
topicId: 1,
userId: 1,
createdAt: 2019-03-14T21:20:25.287Z,
updatedAt: 2019-03-14T21:20:25.287Z },
_changed: {},
_modelOptions:
{ timestamps: true,
validate: {},
freezeTableName: false,
underscored: false,
underscoredAll: false,
paranoid: false,
rejectOnEmpty: false,
whereCollection: { id: 1 },
schema: null,
schemaDelimiter: '',
defaultScope: {},
scopes: [],
indexes: [],
name: { plural: 'Posts', singular: 'Post' },
omitNull: false,
sequelize:
Sequelize {
options: [Object],
config: [Object],
dialect: [PostgresDialect],
queryInterface: [QueryInterface],
models: [Object],
modelManager: [ModelManager],
connectionManager: [ConnectionManager],
importCache: [Object],
test: [Object] },
hooks: {},
uniqueKeys: {} },
_options:
{ isNewRecord: false,
_schema: null,
_schemaDelimiter: '',
raw: true,
attributes:
[ 'id',
'title',
'body',
'topicId',
'userId',
'createdAt',
'updatedAt' ] },
__eagerlyLoadedAssociations: [],
isNewRecord: false }
F
Failures:
1) routes : votes signed in user voting on a post #post.getPoints() should return the number of votes
Message:
TypeError: Cannot read property 'length' of undefined
Stack:
at <Jasmine>
at model.Post.getPoints (/Users/piontekle/bloc/bloccit/src/db/models/post.js:46:19)
at Post.findOne.then (/Users/piontekle/bloc/bloccit/spec/integration/votes_spec.js:242:29)
at tryCatcher (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/promise.js:694:18)
at _drainQueueStep (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/async.js:147:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
Message:
Failed: Cannot read property 'length' of undefined
Stack:
at <Jasmine>
at model.Post.getPoints (/Users/piontekle/bloc/bloccit/src/db/models/post.js:46:19)
at Post.findOne.then (/Users/piontekle/bloc/bloccit/spec/integration/votes_spec.js:242:29)
at tryCatcher (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/promise.js:694:18)
at _drainQueueStep (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/async.js:147:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/piontekle/bloc/bloccit/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
6 specs, 1 failure
Finished in 0.951 seconds
npm ERR! Test failed. See above for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment