()
| 261 | }); |
| 262 | |
| 263 | function givenUserModelWithAuth() { |
| 264 | const AccessToken = app.registry.getModel('AccessToken'); |
| 265 | app.model(AccessToken, {dataSource: 'db'}); |
| 266 | const User = app.registry.getModel('User'); |
| 267 | // Speed up the password hashing algorithm for tests |
| 268 | User.settings.saltWorkFactor = 4; |
| 269 | app.model(User, {dataSource: 'db'}); |
| 270 | |
| 271 | // NOTE(bajtos) This is puzzling to me. The built-in User & AccessToken |
| 272 | // models should come with both relations already set up, i.e. the |
| 273 | // following two lines should not be neccessary. |
| 274 | // And it does behave that way when only tests in this file are run. |
| 275 | // However, when I run the full test suite (all files), the relations |
| 276 | // get broken. |
| 277 | AccessToken.belongsTo(User, {as: 'user', foreignKey: 'userId'}); |
| 278 | User.hasMany(AccessToken, {as: 'accessTokens', foreignKey: 'userId'}); |
| 279 | |
| 280 | return User; |
| 281 | } |
| 282 | |
| 283 | function givenLoggedInUser(cb, done) { |
| 284 | const credentials = {email: 'user@example.com', password: 'pwd'}; |
no outgoing calls
no test coverage detected
searching dependent graphs…