Skip to content

Instantly share code, notes, and snippets.

@frogermcs
Created November 5, 2017 14:02
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 frogermcs/c4efc4ae0c53ba5b28f12abd360bdbf6 to your computer and use it in GitHub Desktop.
Save frogermcs/c4efc4ae0c53ba5b28f12abd360bdbf6 to your computer and use it in GitHub Desktop.
Conversation
actionWelcomeUser
✓ Should create new anonymous user
✓ Should greet new user
✓ Should greet existing user with name if exists
✓ Should greet existing user with general message if name doesnt exists
actionGetLoggedWater
✓ Should tell about logged water for given user
actionLogWater
✓ Should save given amount of water and response with saved value
actionUpdateSettings
✓ Should ask for user name permission
actionUserData
✓ Should finish with permission denied when permission isnt granted
✓ Should finish with unexpected error when permission granted but empty data
✓ Should ask for precise location permission when permission granted, name exists but location doesnt
✓ Should save user name when permission granted and name exists
✓ Should save user timezone and finish when permission granted, name exists and location exists
Cloud Functions
waterLog
TimeManager
getPlatformTime
✓ Should return platform time
getTimeZoneFromCoordinates
✓ Should convert coordinates to timezone
saveAssistantUserTimezone
✓ Should save assistant user timezone into DB
getAssistantUserTimeData
✓ Should return local user time if exists
getTodayStartTimestampForAssistantUser
✓ Should return date for start of the day for user timezone if exists
✓ Should return start of the day date for platform when user timezone doesnt exist
UserManager
isFirstUsage
✓ Should return first usage when user doesnt exist in DB
✓ Shouldnt return first usage when user exists in DB
loadAssistantUser
✓ Shouldnt load expected user from DB
saveAssistantUser
✓ Should save assistant user into DB
saveAssistantUserName
✓ Should save assistant user name into DB
ensureAuthUser
✓ Should authenticate anonymous user when user isnt authenticated
✓ Should return authenticated user
WaterLog
saveLoggedWater
✓ Should save logged mililiters of water
✓ Should save logged liters of water
getLoggedWaterForUser
✓ Should load logged water for given user and present data from recent day
29 passing (97ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment