Skip to content

Instantly share code, notes, and snippets.

@zenithtekla
Created August 11, 2016 23:48
Show Gist options
  • Save zenithtekla/9899b1072df18c9c2f6aa2b41a5325b5 to your computer and use it in GitHub Desktop.
Save zenithtekla/9899b1072df18c9c2f6aa2b41a5325b5 to your computer and use it in GitHub Desktop.
Bossable
Running "mochaTest:src" (mochaTest) task
Article Model Unit Tests:
Method Save
✓ should be able to save without problems (76ms)
✓ should be able to show an error when try to save without title
Article CRUD tests
✓ should be able to save an article if logged in (275ms)
✓ should not be able to save an article if not logged in
✓ should not be able to save an article if no title is provided (99ms)
✓ should be able to update an article if signed in (141ms)
✓ should be able to get a list of articles if not signed in (42ms)
✓ should be able to get a single article if not signed in
✓ should return proper error for single article with an invalid Id, if not signed in
✓ should return proper error for single article which doesnt exist, if not signed in
✓ should be able to delete an article if signed in (205ms)
✓ should not be able to delete an article if not signed in
✓ should be able to get a single article that has an orphaned user reference (312ms)
✓ should be able to get a single article if signed in and verify the custom "isCurrentUserOwner" field is set to "true" (169ms)
✓ should be able to get a single article if not signed in and verify the custom "isCurrentUserOwner" field is set to "false"
✓ should be able to get single article, that a different user created, if logged in & verify the "isCurrentUserOwner" field is set to "false" (278ms)
Configuration Tests:
Testing default seedDB
✓ should have seedDB configuration set for "regular" user
✓ should have seedDB configuration set for admin user
✓ should not be an admin user to begin with
✓ should not be a "regular" user to begin with
✓ should seed ONLY the admin user account when NODE_ENV is set to "production" (245ms)
✓ should seed admin, and "regular" user accounts when NODE_ENV is set to "test" (152ms)
✓ should seed admin, and "regular" user accounts when NODE_ENV is set to "test" when they already exist (178ms)
✓ should ONLY seed admin user account when NODE_ENV is set to "production" with custom admin (73ms)
✓ should seed admin, and "regular" user accounts when NODE_ENV is set to "test" with custom options (132ms)
✓ should NOT seed admin user account if it already exists when NODE_ENV is set to "production"
✓ should NOT seed "regular" user account if missing email when NODE_ENV set to "test"
Testing Session Secret Configuration
✓ should warn if using default session secret when running in production
✓ should accept non-default session secret when running in production
✓ should accept default session secret when running in development
✓ should accept default session secret when running in test
Testing Logger Configuration
✓ should retrieve the log format from the logger configuration
✓ should retrieve the log options from the logger configuration
✓ should verify that a writable stream was created using the logger configuration
✓ should use the default log format of "combined" when an invalid format was provided
✓ should remove the stream option when an invalid filename was supplied for the log stream option
✓ should remove the stream option when an invalid directory path was supplied for the log stream option
✓ should confirm that the log directory is created if it does not already exist
✓ should remove the stream option when an invalid filename was supplied for the rotating log stream option
✓ should confirm that the rotating log is created using the logger configuration
✓ should confirm that the rotating log directory is created if it does not already exist
Customer Model Unit Tests:
Method Save
✓ should be able to save without problems
✓ should be able to show an error when try to save without name
Customer CRUD tests
✓ should be able to save a Customer if logged in (101ms)
✓ should not be able to save an Customer if not logged in
✓ should not be able to save an Customer if no name is provided (137ms)
✓ should be able to update an Customer if signed in (121ms)
✓ should be able to get a list of Customers if not signed in
✓ should be able to get a single Customer if not signed in
✓ should return proper error for single Customer with an invalid Id, if not signed in
✓ should return proper error for single Customer which doesnt exist, if not signed in
✓ should be able to delete an Customer if signed in (152ms)
✓ should not be able to delete an Customer if not signed in
✓ should be able to get a single Customer that has an orphaned user reference (294ms)
User Model Unit Tests:
Method Save
✓ should begin with no users
✓ should be able to save without problems (53ms)
✓ should fail to save an existing user again (130ms)
✓ should be able to show an error when trying to save without first name
✓ should be able to update an existing user with valid roles without problems (58ms)
✓ should be able to show an error when trying to update an existing user without a role (61ms)
✓ should be able to show an error when trying to update an existing user with a invalid role (51ms)
✓ should confirm that saving user model doesnt change the password (63ms)
✓ should be able to save 2 different users (112ms)
✓ should not be able to save another user with the same email address (119ms)
✓ should not index missing email field, thus not enforce the model's unique index (129ms)
✓ should not save the password in plain text (57ms)
✓ should not save the passphrase in plain text (49ms)
User Password Validation Tests
✓ should validate when the password strength passes - "P@$$w0rd!!"
✓ should validate a randomly generated passphrase from the static schema method
✓ should validate when the password is undefined
✓ should validate when the passphrase strength passes - "Open-Source Full-Stack Solution For MEAN Applications"
✓ should not allow a password less than 10 characters long - "P@$$w0rd!"
✓ should not allow a password greater than 128 characters long.
✓ should not allow a password with 3 or more repeating characters - "P@$$w0rd!!!"
✓ should not allow a password with no uppercase letters - "p@$$w0rd!!"
✓ should not allow a password with less than one number - "P@$$word!!"
✓ should not allow a password with less than one special character - "Passw0rdss"
User E-mail Validation Tests
✓ should not allow invalid email address - "123"
✓ should not allow invalid email address - "123@123@123"
✓ should allow email address - "123@123" (40ms)
✓ should not allow invalid email address - "123.com"
✓ should not allow invalid email address - "@123.com"
✓ should not allow invalid email address - "abc@abc@abc.com"
✓ should not allow invalid characters in email address - "abc~@#$%^&*()ef=@abc.com"
✓ should not allow space characters in email address - "abc def@abc.com"
✓ should not allow doudble quote characters in email address - "abc"def@abc.com"
✓ should not allow double dotted characters in email address - "abcdef@abc..com"
✓ should allow single quote characters in email address - "abc'def@abc.com" (54ms)
✓ should allow valid email address - "abc@abc.com" (54ms)
✓ should allow valid email address - "abc+def@abc.com" (50ms)
✓ should allow valid email address - "abc.def@abc.com" (54ms)
✓ should allow valid email address - "abc.def@abc.def.com" (71ms)
✓ should allow valid email address - "abc-def@abc.com" (64ms)
User CRUD tests
✓ should be able to register a new user (85ms)
✓ should be able to login successfully and logout successfully (120ms)
✓ should not be able to retrieve a list of users if not admin (89ms)
✓ should be able to retrieve a list of users if admin (121ms)
✓ should be able to get a single user details if admin (105ms)
✓ should be able to update a single user details if admin (136ms)
✓ should be able to delete a single user if admin (110ms)
✓ forgot password should return 400 for non-existent username
✓ forgot password should return 400 for no username provided
✓ forgot password should return 400 for non-local provider set for the user object (59ms)
✓ forgot password should be able to reset password for user password reset request (161ms)
✓ forgot password should be able to reset the password using reset token (55ms)
✓ forgot password should return error when using invalid reset token (55ms)
✓ should be able to change user own password successfully (187ms)
✓ should not be able to change user own password if wrong verifyPassword is given (138ms)
✓ should not be able to change user own password if wrong currentPassword is given (128ms)
✓ should not be able to change user own password if no new password is at all given (102ms)
✓ should not be able to change user own password if no new password is at all given
✓ should be able to get own user details successfully (93ms)
✓ should not be able to get any user details if not logged in
✓ should be able to update own user details (72ms)
✓ should not be able to update own user details and add roles if not admin (85ms)
✓ should not be able to update own user details with existing username (130ms)
✓ should not be able to update own user details with existing email (129ms)
✓ should not be able to update own user details if not logged-in
✓ should not be able to update own user profile picture without being logged-in
✓ should be able to change profile picture if signed in (162ms)
✓ should not be able to change profile picture if attach a picture with a different field name (94ms)
121 passing (11s)
Running "karma:unit" (karma) task
11 08 2016 23:28:43.618:INFO [karma]: Karma v0.13.22 server started at http://0.0.0.0:9876/
11 08 2016 23:28:43.629:INFO [launcher]: Starting browser PhantomJS
11 08 2016 23:28:44.595:ERROR [phantomjs.launcher]: Fontconfig warning: ignoring C.UTF-8: not a valid language tag
11 08 2016 23:28:45.189:INFO [PhantomJS 2.1.1 (Linux 0.0.0)]: Connected on socket /#KKaJdothJ55bOw8EAAAA with id 46921736
PhantomJS 2.1.1 (Linux 0.0.0): Executed 227 of 229 (skipped 2) SUCCESS (3.215 secs / 3.473 secs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment