Skip to content

Instantly share code, notes, and snippets.

@heygambo
Created January 15, 2020 10:02
Show Gist options
  • Select an option

  • Save heygambo/5151096e79d978a1fe088553ff36b57b to your computer and use it in GitHub Desktop.

Select an option

Save heygambo/5151096e79d978a1fe088553ff36b57b to your computer and use it in GitHub Desktop.
firebase-mock-list-collections-specs.log
(feature/add-list-collections) firebase-mock ツ npm run test
> firebase-mock@2.3.0 test /Users/gambo/code/github/firebase-mock
> gulp lint && gulp test
[11:00:45] Using gulpfile ~/code/github/firebase-mock/gulpfile.js
[11:00:45] Starting 'lint'...
[11:00:46] Finished 'lint' after 1.15 s
[11:00:49] Using gulpfile ~/code/github/firebase-mock/gulpfile.js
[11:00:49] Starting 'test'...
[11:00:49] Starting 'cover'...
[11:00:50] Finished 'cover' after 805 ms
[11:00:50] Starting '<anonymous>'...
Auth
#changeAuthState
βœ“ sets the auth data
βœ“ is a noop if deeply equal
βœ“ is a noop if deeply equal
βœ“ sets null for a non object
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ triggers an auth event
#getUserByEmail
βœ“ gets a copy of the user by email
βœ“ only searches own properties
βœ“ fails when user not found
#getUser
βœ“ gets a copy of the user by uid
βœ“ only searches own properties
βœ“ fails when user not found
#auth
FIREBASE WARNING: FirebaseRef.auth() being deprecated. Please use FirebaseRef.authWithCustomToken() instead.
βœ“ calls callback on auth state change
#authWithCustomToken
βœ“ calls the callback with a nextErr
βœ“ invokes the callback when auth state is set
βœ“ handles no callback
#getAuth
βœ“ is null by default
βœ“ returns the value from changeAuthState
#onAuth
βœ“ is triggered when changeAuthState modifies data
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ is not be triggered if auth state does not change
βœ“ can set a context
βœ“ synchronously triggers the callback with the current auth data
#offAuth
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ removes a callback
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ only removes callback that matches the context
#unauth
βœ“ sets auth data to null
βœ“ triggers onAuth callback if not null
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ does not trigger auth events if not authenticated
#onIdTokenChanged
βœ“ is triggered when changeAuthState modifies the user
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ is not triggered when auth state does not change
βœ“ synchronously triggers the callback with the current auth data
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ does not trigger after unsubscribe
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ is triggered if only ID token changes
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ is triggered on updating current user
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ is not triggered on updating non-current user
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ is not triggered on updating current user with the same info
#onAuthStateChanged
βœ“ is triggered when changeAuthState modifies the user
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ is not triggered when auth state does not change
βœ“ synchronously triggers the callback with the current auth data
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ does not trigger after unsubscribe
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ is not triggered if only ID token changes
#createUser
βœ“ creates a new user
βœ“ creates a new user without a password
βœ“ creates a new user and returns promise
βœ“ increments the id for each user
βœ“ creates a new user with preset uid
βœ“ creates a new user with preset additional attributes
βœ“ fails if credentials is not an object
βœ“ fails if email is not a string
βœ“ fails if user already exists
βœ“ fails if failNext is set
#createUserWithEmailAndPassword
βœ“ creates a new user
βœ“ fails if failNext is set
#changeEmail
βœ“ changes the email
βœ“ fails if credentials is not an object
βœ“ fails if oldEmail is not a string
βœ“ should fail if newEmail is not a string
βœ“ fails if password is not a string
βœ“ fails if user does not exist
βœ“ fails if password is incorrect
βœ“ fails if failNext is set
#changePassword
βœ“ changes the password
βœ“ fails if credentials is not an object
βœ“ fails if email is not a string
βœ“ should fail if oldPassword is not a string
βœ“ fails if newPassword is not a string
βœ“ fails if user does not exist
βœ“ fails if oldPassword is incorrect
βœ“ fails if failNext is set
#removeUser
βœ“ removes the account
βœ“ fails if credentials is not an object
βœ“ fails if email is not a string
βœ“ fails if password is not a string
βœ“ fails if user does not exist
βœ“ fails if password is incorrect
βœ“ fails if failNext is set
#resetPassword
βœ“ simulates reset if credentials are valid
βœ“ fails if credentials is not an object
βœ“ fails if email is not a string
βœ“ fails if user does not exist
βœ“ fails if failNext is set
#verifyIdToken
βœ“ succeeds if user exists with token
βœ“ should populates claims
βœ“ fails if no user exists with token
βœ“ fails if failNext is set
#setCustomUserClaims
βœ“ succeeds if user exists
βœ“ fails if no user exists with token
βœ“ fails if failNext is set
#updateUser
βœ“ should replace the existing user
βœ“ preserves deep equality of users
βœ“ should select by uid
βœ“ should return the updated user
βœ“ should store a referentially different user from the argument
βœ“ should reject if the user does not exist
βœ“ should wait for flush
API.md
Auth example for changeAuthState
βœ“ works as described
Messaging examples
βœ“ send messages
βœ“ returns custom message responses
βœ“ callback on sending messages
MockFirebase
set & transition
βœ“ should work
Array rendering
βœ“ renders array-like data as an array
Server Timestamps
βœ“ parses server timestamps
βœ“ parses server timestamps in child data
βœ“ parses server timestamps in priorities
Firebase#setClock
βœ“ sets a timestamp factory function
#restoreClock
βœ“ restores the normal clock
#flush
βœ“ flushes the queue and returns itself
#autoFlush
βœ“ enables autoflush with no args
βœ“ can specify a flush delay
βœ“ sets the delay on all children
βœ“ sets the delay on a parent
βœ“ returns itself
#failNext
βœ“ must be called with an Error
#forceCancel
βœ“ calls the cancel callback
βœ“ calls the cancel callback on the context
βœ“ turns off the listener
βœ“ can match an event type
βœ“ can match a callback
βœ“ can match a context
βœ“ can take null as the cancel callback
#fakeEvent
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ can trigger a fake value event
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ can trigger a fake child_added event
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ uses null as the default data
#child
βœ“ requires a path
βœ“ caches children
βœ“ calls child recursively for multi-segment paths
βœ“ can use leading slashes (#23)
βœ“ can use trailing slashes (#23)
#parent
βœ“ gets a parent ref
#ref
βœ“ returns itself
βœ“ child / returns same reference
#set
βœ“ should validate the data
βœ“ should return a promise
βœ“ should remove old keys from data
βœ“ should remove empty properties from data
βœ“ should set priorities on children if included in data
βœ“ should have correct priority in snapshot if added with set
βœ“ should fire child_added events with correct prevChildName
βœ“ should fire child_added events with correct priority
βœ“ should trigger child_removed if child keys are missing
βœ“ should change parent from null to object when child is set
#setPriority
βœ“ should trigger child_moved with correct prevChildName
βœ“ should trigger a callback
βœ“ can be called on the root
#setWithPriority
βœ“ should pass the priority to #setPriority
βœ“ should pass the data and callback to #set
#update
βœ“ must be called with an object
βœ“ should validate the data
βœ“ extends the data
βœ“ removes empty data
βœ“ can work with nested paths
βœ“ can work with nested paths beginning with /
βœ“ overrides the paths with existing data
βœ“ does not change unrelated data
βœ“ handles multiple calls in the same flush
βœ“ can be called on an empty reference
βœ“ can simulate an error
#remove
βœ“ should return a promise
βœ“ fires child_removed for children
βœ“ changes to null if all children are removed
βœ“ can simulate an error
#on
βœ“ validates the event name
βœ“ should work when initial value is null
βœ“ can take the context as the 3rd argument
βœ“ can simulate an error
βœ“ can simulate an error
βœ“ is cancelled by an off call before flush
βœ“ returns the callback
#once
βœ“ validates the event name
βœ“ only fires the listener once
βœ“ can catch a simulated error
βœ“ can provide a context in place of cancel
#off
βœ“ validates the event name
βœ“ can disable all events
sinon.reset is deprecated and will be removed from the public API in a future version of sinon.
βœ“ can disable a specific event
#transaction
βœ“ should call the transaction function
βœ“ should fire the callback with a "committed" boolean and error message
βœ“ should return a promise wrapping a "committed" boolean and a snapshot
βœ“ should update primative value
βœ“ should update property value
βœ“ should update nested property value
βœ“ should remove empty properties from data
#push
βœ“ should validate the data
βœ“ should return thenable reference
βœ“ should return thenable reference when no arguments are passed
βœ“ can add data by auto id
βœ“ can simulate an error
βœ“ avoids calling set when unnecessary
#root
βœ“ traverses to the top of the reference
#getFlushQueue
βœ“ returns an array equal to number of flush events queued
βœ“ does not change length if more items are added to the queue
βœ“ sets the ref attribute correctly
βœ“ sets the `method` attribute correctly
βœ“ sets the `args` attribute correctly
Firebase.autoId
βœ“ fails to add nested data by auto id
βœ“ succeeds to add nested data by auto id, when Firebase.autoId is replaced
MockFirestoreCollection
#flush
βœ“ flushes the queue and returns itself
#autoFlush
βœ“ enables autoflush with no args
βœ“ can specify a flush delay
βœ“ sets the delay on all collections and documents
βœ“ sets the delay on a parent
βœ“ returns itself
#get
βœ“ allow calling get()
βœ“ retrieves all no data for non-existing collection
βœ“ retrieves all data for existing collection
βœ“ retrieves data added to collection
βœ“ retrieves data set as document
#doc
βœ“ allow calling doc()
βœ“ allow calling doc() with empty path to generate id
βœ“ creates child documents with a firestore property pointing at the root db
βœ“ creates child documents with a firestore property pointing at the firestore of the collection
#add
βœ“ allow calling add()
βœ“ allow adding data to empty collection
βœ“ allow adding data to existing collection
#where
βœ“ caches children
βœ“ allow calling where() on collection
βœ“ allow calling where() multiple times
βœ“ results contain ref for each doc
βœ“ returns matched documents for operator "=="
βœ“ returns matched documents for operator "array-contains"
Using unsupported where() operator for firebase-mock, returning entire dataset
Using unsupported where() operator for firebase-mock, returning entire dataset
βœ“ returns all documents when using unsupported operator
βœ“ returns matched documents with multiple where calls
βœ“ allow using complex path
#stream
βœ“ returns a stream that emits all results
#orderBy
βœ“ allow calling orderBy() on collection
βœ“ allow calling orderBy() multiple times
βœ“ returns documents is desired order
βœ“ returns documents ordered by name using FieldPath
βœ“ returns documents ordered by id
βœ“ returns documents ordered by timestamp
βœ“ returns documents ordered by date
#startAfter
βœ“ returns data after the specified value
βœ“ works with limit
βœ“ throws with no order
#limit
βœ“ allow calling limit() on collection
βœ“ returns limited amount of documents
#listDocuments
βœ“ retrieves all data for existing collection
βœ“ retrieves data added to collection
#onSnapshot
βœ“ returns value after collection is updated
βœ“ calls callback after multiple updates
βœ“ should unsubscribe
βœ“ Calls onError if error
DocumentDeltaSnapshot
#exists
βœ“ returns false if no data
βœ“ returns true if data available
#data
βœ“ returns null if no data
βœ“ returns data if data provided
#get
βœ“ returns undefined if data does not exist
βœ“ returns undefined if data does not exist
βœ“ returns undefined if path is empty
βœ“ returns undefined if path does not exist
βœ“ returns data if path exists
βœ“ returns data with complex path
#create
βœ“ returns snapshot at correct path
βœ“ returns snapshot with correct data from previous value
adding doc
βœ“ correctly applies delta when adding doc
updating doc
βœ“ correctly applies delta when adding data
βœ“ correctly applies delta when removing data
βœ“ correctly applies delta when changing data
deleting doc
βœ“ correctly applies delta when deleting doc
DocumentSnapshot
#exists
βœ“ returns false if no data
βœ“ returns true if data is empty
βœ“ returns true if data available
#data
βœ“ returns null if no data
βœ“ returns empty data if empty data provided
βœ“ returns data if data provided
βœ“ returns clone of data
#get
βœ“ returns undefined if data does not exist
βœ“ returns undefined if data does not exist
βœ“ returns undefined if path is empty
βœ“ returns undefined if path does not exist
βœ“ returns undefined if path leads to null value
βœ“ returns data if path exists
βœ“ returns data if field path exists
βœ“ returns data with complex path
βœ“ returns data with complex field path
βœ“ returns document id
#ref
βœ“ returns ref for document
MockFirestoreDocument
#flush
βœ“ flushes the queue and returns itself
#autoFlush
βœ“ enables autoflush with no args
βœ“ can specify a flush delay
βœ“ sets the delay on all collections
βœ“ sets the delay on a parent
βœ“ returns itself
#collection
βœ“ allow calling collection()
βœ“ creates child collections with a firestore property pointing at the root db
βœ“ creates child collections with a firestore property pointing at the firestore of the collection
#get
βœ“ gets value of doc
βœ“ results contain ref for doc
#create
βœ“ creates a new doc
βœ“ creates a new doc with null values
βœ“ creates a new doc with server time values
βœ“ throws an error when a doc already exists
#set
βœ“ sets value of doc
βœ“ sets value of doc with null values
βœ“ sets value of doc with server timestamp
βœ“ sets value of doc with ref
#set with {merge: true}
βœ“ creates doc if does not exist
βœ“ creates doc with null values if does not exist
βœ“ updates value of doc
βœ“ updates value of doc with null values
βœ“ can update date fields
#update
βœ“ updates value of doc
βœ“ updates value of doc with null properties
βœ“ updates value of doc with server time value
βœ“ removes property when using FieldValue.delete()
βœ“ updates an array property when using FieldValue.arrayRemove()
βœ“ updates an array property when using FieldValue.arrayUnion()
βœ“ does not merge nested properties recursively by default
βœ“ merges nested properties recursively when using nested paths
βœ“ can update date fields
#delete
βœ“ delete doc
#getCollections
when present
βœ“ returns collections of document
βœ“ returns deeply nested collections of document
when not present
βœ“ returns empty list of collections
βœ“ skips collections that has no documents
#listCollections
when present
βœ“ returns collections of document
βœ“ returns deeply nested collections of document
when not present
βœ“ returns empty list of collections
βœ“ skips collections that has no documents
#onSnapshot
βœ“ calls observer with initial state
βœ“ calls observer when document is updated
βœ“ does not call observer when no changes occur
βœ“ returns error if error occured
βœ“ does not returns value when not updated
βœ“ unsubscribes
βœ“ accepts option includeMetadataChanges
FieldPath
constructor
βœ“ should have path to "name"
#documentId
βœ“ should be a function
βœ“ should return FieldPath
βœ“ should have path to "documentId"
#isEqual
βœ“ should be a function
βœ“ should work with FieldPath.delete()
FieldValue
#delete
βœ“ should be a function
βœ“ should return FieldValue
βœ“ should type to "delete"
#serverTimestamp
βœ“ should be a function
βœ“ should return FieldValue
βœ“ should type to "serverTimestamp"
#arrayRemove
βœ“ should be a function
βœ“ should return FieldValue
βœ“ should type to "serverTimestamp"
#arrayUnion
βœ“ should be a function
βœ“ should return FieldValue
βœ“ should type to "serverTimestamp"
#isEqual
βœ“ should be a function
βœ“ should work with FieldValue.delete()
βœ“ should work with FieldValue.serverTimestamp()
QuerySnapshot
#forEach
βœ“ calls the callback with each child
βœ“ can set a this value
βœ“ passes ref for each doc
#empty
βœ“ tests for children
#size
βœ“ returns the object size
βœ“ returns 0 for a null snapshot
#docs
βœ“ returns the data as an array of snapshots
MockFirestore
#flush
βœ“ flushes the queue and returns itself
#autoFlush
βœ“ enables autoflush with no args
βœ“ can specify a flush delay
βœ“ sets the delay on all collections and documents
βœ“ returns itself
#collection
βœ“ allow calling collection()
βœ“ allow calling collection() with complex path
βœ“ caches children
βœ“ caches deep children
βœ“ caches deep children with paths
βœ“ creates child collection with a firestore property pointing at itself
#doc
βœ“ allow calling doc()
βœ“ allow calling doc() with complex path
βœ“ caches children
βœ“ caches deep children
βœ“ caches deep children with paths
βœ“ creates child document with a firestore property pointing at itself
#runTransaction
βœ“ transaction updates data
βœ“ returns the return value of the passed function
#batch
βœ“ batch runs commands after commit
βœ“ works with set + merge
βœ“ supports method chaining
when "batch.commit" is not called
βœ“ does not create documents
#getAll
βœ“ gets the value of all passed documents
MockMessaging
#flush
βœ“ flushes the queue and returns itself
#autoFlush
βœ“ enables autoflush with no args
βœ“ can specify a flush delay
βœ“ returns itself
#on
βœ“ throws if callback is not a function
βœ“ registers a callback
#send
βœ“ should check that message is not undefined
βœ“ should return thenable reference
βœ“ can simulate an error
βœ“ can return user defined results
βœ“ invokes callback with args
#sendAll
βœ“ should check that messages is an array
βœ“ should return thenable reference
βœ“ can simulate an error
βœ“ can return user defined results
βœ“ invokes callback with args
#sendMulticast
βœ“ should check that message is not undefined
βœ“ should check that message contains a "tokens" array
βœ“ should return thenable reference
βœ“ can simulate an error
βœ“ can return user defined results
βœ“ invokes callback with args
MockQuery
#ref
βœ“ returns the ref used to create the query
#flush
βœ“ flushes the ref
#autoFlush
βœ“ autoFlushes the ref
#getData
βœ“ gets data from the slice
#fakeEvent
βœ“ validates the event name
βœ“ fires the matched event with a snapshot
on
βœ“ validates the event name
value
βœ“ should provide value immediately
βœ“ should return null if nothing in range exists
βœ“ should return correct keys
βœ“ should update on change
βœ“ should not update on change outside range
βœ“ can take the context as the 3rd argument
βœ“ should work with equalTo
βœ“ should work with boolean equalTo
βœ“ should return null if not equalTo
once
βœ“ validates the event name
βœ“ should be triggered if value is null
βœ“ should be triggered if value is not null
βœ“ should not get triggered twice
child_added
- should include prevChild
βœ“ should trigger all keys in initial range
- should notify on a new added event after init
- should not notify for add outside range
- should trigger a child_removed if using limitToLast
βœ“ should work if connected from instead a once "value"
child_changed
- should trigger for a key in range
- should not trigger for a key outside of range
child_removed
- should trigger for a child in range
- should not trigger for a child out of range
- should trigger a child_added for replacement if using limitToLast
child_moved
- should trigger if item in range moves in range
- should trigger child_removed if goes out of range
- should trigger child_added if moved in range
off
- should not notify on callbacks
limitToFirst
- should throw Error if non-integer argument
βœ“ should return correct number of results
βœ“ should work if does not match any results
- should be relevant to endAt()
- should be relevant to startAt()
limitToLast
- should throw Error if non-integer argument
βœ“ should return correct number of results
βœ“ should work if does not match any results
- should be relevant to endAt()
- should be relevant to startAt()
endAt
- should make limit relative to the end of data
- should stop at the priority given
- should stop at the key given
- should stop at the key+priority given
startAt
- should make limit relative to start of data
- should start at the priority given
- should start at the key given
- should start at the key+priority given
FlushQueue
βœ“ constructs an empty event queue
βœ“ removes events when they are cancelled
#push
βœ“ pushes simple events onto the queue like [].push
βœ“ pushes complex events
#flush
βœ“ is throws when there are no deferreds
βœ“ fires the events synchronously by default
βœ“ fires events added during queue processing
βœ“ prevents recursive flush calls
βœ“ can invoke events after a delay
#getEvents
βœ“ returns a copy of the events
FlushEvent
#run
βœ“ runs the event handler on the context
βœ“ emits a done event
#cancel
βœ“ emits a done event
MockFirebaseSdk
Dependency Injection
βœ“ returns DI for database().ref()
βœ“ returns DI for database().refFromURL()
βœ“ returns DI for auth()
#database
βœ“ returns object with ref properties
βœ“ ServerValue
#ref
βœ“ returns a MockFirebase reference
#refFromURL
βœ“ returns a MockFirebase reference
#firestore
βœ“ returns object with doc and collection functions
βœ“ FieldValue.delete
βœ“ FieldValue.serverTimestamp
βœ“ FieldValue.arrayRemove
βœ“ FieldValue.arrayUnion
βœ“ FieldPath.documentId
#auth
βœ“ returns Authentication object without ref property
βœ“ should get credential
#EmailAuthProvider
βœ“ sets provider id
βœ“ should get credential
#GoogleAuthProvider
βœ“ sets provider id
βœ“ should get credential
#TwitterAuthProvider
βœ“ sets provider id
βœ“ should get credential
#FacebookAuthProvider
βœ“ sets provider id
βœ“ should get credential
#GithubAuthProvider
βœ“ sets provider id
#initializeApp
βœ“ returns firebase app
DataSnapshot
#ref
βœ“ returns the reference
#val
βœ“ returns a deep clone of the data
βœ“ returns null for an empty object
#getPriority
βœ“ returns the priority
#child
βœ“ generates a snapshot for a child ref
βœ“ uses child data
βœ“ uses child data starting with /
βœ“ uses child data ending with /
βœ“ uses child data for false values
βœ“ uses child data for 0 values
βœ“ uses child data when accessing with multiple paths
βœ“ uses child data when accessing with multiple paths for false values
βœ“ uses child data when accessing with multiple paths for 0 values
βœ“ uses null when there is no child data
βœ“ uses null when there is no child data with multiple paths
βœ“ passes the priority
βœ“ allows array indexes
βœ“ allows array indexes in multiple paths
#exists
βœ“ checks for a null value
#forEach
βœ“ calls the callback with each child
βœ“ can set a this value
#hasChild
βœ“ can handle null snapshots
βœ“ tests for the key
βœ“ tests for the key starting with /
βœ“ tests for the key ending with /
βœ“ tests for the key with multiple paths
#hasChildren
βœ“ tests for children
#key
βœ“ returns the ref key
#name
DataSnapshot.name() is deprecated. Use DataSnapshot.key
βœ“ passes through to #key
#numChildren
βœ“ returns the object size
βœ“ returns 0 for a null snapshot
#exportVal
βœ“ handles primitives with no priority
βœ“ handles primitives with priorities
βœ“ recursively builds an export object
StorageBucket
constructor
βœ“ should add storage reference
#file
βœ“ should create file
#getFiles
βœ“ should get all files without query
βœ“ should get only matched prefix files
#deleteFiles
βœ“ should delete all files without query
βœ“ should delete only matched prefix files
StorageFile
constructor
βœ“ should add bucket reference
#get
βœ“ should get file
#save
βœ“ should save contents
#exists
βœ“ should not exist when no content
βœ“ should exist when content added
#getSignedUrl
βœ“ should get url
#download
βœ“ should download file
βœ“ should send file as a buffer
βœ“ should access file from different refs via same bucket
#delete
βœ“ should delete file from bucket
βœ“ should not exist after file deleted
#move
βœ“ should move file using string
βœ“ should move file using File
βœ“ should move file using Bucket
#getMetadata
βœ“ should get metadata
#setMetadata
βœ“ should set metadata
StorageFile
constructor
βœ“ should add storage reference
#child
βœ“ should work with basic path
βœ“ should work with complex path
#getDownloadURL
βœ“ should get url
Storage
#bucket
βœ“ should create bucket
βœ“ should not recreate bucket with the same name
#ref
βœ“ should work with basic path
βœ“ should work with complex path
βœ“ should work with leading slash in path
βœ“ should work with trailing slash in path
βœ“ should work with multiple consecutive slashes in path
Timestamp
fromDate
βœ“ should convert from date
fromMillis
βœ“ should convert from milliseconds
#toDate
βœ“ should convert to date
User
βœ“ should be exported
#constructor
βœ“ should reject ID tokens that expire before the issuance time
βœ“ should reject ID tokens that are issued before the auth time
βœ“ should reject ID tokens that are issued in the future
βœ“ should reject ID tokens that show the user authenticating in the future
βœ“ should keep reference to passed-in auth
#clone
βœ“ deep copies custom claims
βœ“ preserves reference to auth
βœ“ preserves deep equality
#delete
βœ“ should delete user
#reload
βœ“ should reload email when changed
#updateEmail
βœ“ should change email
#updatePassword
βœ“ should change password
#updateProfile
βœ“ should change display name
βœ“ should change photo URL
#getIdToken
βœ“ should get token
βœ“ should refresh token
βœ“ should refresh token result
#getIdTokenResult
βœ“ should use defaults if the id token result param is omitted
without forceRefresh
.authTime
βœ“ should use provided auth time
βœ“ should default auth time to current time
.issuedAtTime
βœ“ should use provided issued-at time
βœ“ should default to auth time
.expirationTime
βœ“ should use provided expiration time
βœ“ should default to issued at time plus 1 hour
.signInProvider
βœ“ should use User's providerId string
βœ“ should default to null
.claims
βœ“ should use user's customClaims object
βœ“ should default to empty object
.token
βœ“ should be the same as returned from getIdToken
with forceRefresh
βœ“ should refresh the ID token
#_refreshIdToken
βœ“ should return a new token result
βœ“ should persist the new token result
βœ“ should use the previous token's authTime by default
βœ“ should use current time as new issuance time by default
βœ“ should expire one hour after issuance by default
βœ“ should update the upstream user if there is one
βœ“ should accept missing upstream users
#toJSON
most fields
βœ“ should be the same
.metadata
βœ“ keys should be missing if omitted
βœ“ should populate to lastLogin if present
βœ“ should populate to createdAt if present
utils
removeEmptyRtdbProperties
βœ“ should return null, when the obj is empty
βœ“ should make no changes, when obj does not contain an empty property
βœ“ should make no changes, when obj is a bool
βœ“ should make no changes, when obj is a string
βœ“ should make no changes, when obj is a number
βœ“ should make no changes, when obj is a NaN
βœ“ should make no changes, when obj is a undefined
βœ“ should remove property, when it is null
βœ“ should remove property, when it is an empty object
βœ“ should remove property, when it is an empty array
βœ“ should return null, when all properties are null
removeEmptyFirestoreProperties
βœ“ should return null, when the obj is empty
βœ“ should make no changes, when obj does not contain an empty property
βœ“ should make no changes, when obj is a bool
βœ“ should make no changes, when obj is a string
βœ“ should make no changes, when obj is a number
βœ“ should make no changes, when obj is a Date
βœ“ should make no changes, when obj is a Timestamp
βœ“ should make no changes, when obj is a NaN
βœ“ should make no changes, when obj is a undefined
βœ“ should remove property, when it is null
βœ“ should remove property, when it is an empty object
βœ“ should remove property, when it is an empty array
βœ“ should return null, when all properties are null
updateToRtdbObject
βœ“ should split the properties by slash
βœ“ should not overwrite updates to the same branch
βœ“ should not touch properties without slash
βœ“ should ignore leading slash
updateToFirestoreObject
βœ“ should split the properties by dot
βœ“ should not overwrite updates to the same branch
βœ“ should not touch properties without dot
βœ“ should ignore leading slash
priorityComparator
βœ“ should give no priority to equal items
βœ“ should order null items first
βœ“ should order false before true
βœ“ should order booleans before numbers
βœ“ should order numbers before strings
βœ“ should order numbers in ascending order
βœ“ should order strings lexicographically
613 passing (1s)
27 pending
---------------------------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
---------------------------------------|----------|----------|----------|----------|----------------|
src/ | 93.58 | 83.32 | 90.7 | 93.86 | |
auth.js | 91.11 | 62.5 | 66.67 | 91.11 | 34,37,44,74 |
firebase-auth.js | 89.75 | 82.73 | 86.32 | 90.17 |... 574,575,576 |
firebase.js | 96.27 | 93.95 | 92.31 | 96.15 |... 645,646,647 |
firestore-collection.js | 93.94 | 64.29 | 86.67 | 93.75 | 24,46,79,94 |
firestore-delta-document-snapshot.js | 94.74 | 87.5 | 100 | 94.74 | 24 |
firestore-document-snapshot.js | 100 | 100 | 100 | 100 | |
firestore-document.js | 91.79 | 70.97 | 89.47 | 92.19 |... 203,265,319 |
firestore-field-path.js | 91.67 | 100 | 75 | 91.67 | 17 |
firestore-field-value.js | 100 | 100 | 100 | 100 | |
firestore-query-snapshot.js | 100 | 100 | 100 | 100 | |
firestore-query.js | 92.71 | 73.2 | 89.19 | 92.63 |... 220,254,319 |
firestore.js | 92.19 | 80 | 86.21 | 92.91 |... 216,217,218 |
index.js | 100 | 100 | 100 | 100 | |
lodash.js | 100 | 100 | 100 | 100 | |
messaging.js | 98.65 | 91.67 | 100 | 98.65 | 123 |
query.js | 86.73 | 68 | 95.65 | 86.73 |... 136,148,178 |
queue.js | 100 | 100 | 100 | 100 | |
sdk.js | 96.77 | 58.33 | 90 | 96.77 | 86,90 |
slice.js | 80.8 | 71.74 | 72.22 | 82.79 |... 165,174,177 |
snapshot.js | 100 | 100 | 100 | 100 | |
storage-bucket.js | 100 | 93.75 | 100 | 100 | |
storage-file.js | 98.11 | 91.67 | 100 | 98.11 | 52 |
storage-reference.js | 83.33 | 100 | 50 | 83.33 |... 62,63,67,68 |
storage.js | 100 | 83.33 | 100 | 100 | |
timestamp.js | 100 | 100 | 100 | 100 | |
user.js | 98.21 | 97.06 | 100 | 99.1 | 136 |
utils.js | 98.09 | 94.17 | 100 | 98.7 | 26,50 |
validators.js | 100 | 100 | 100 | 100 | |
write-result.js | 100 | 100 | 100 | 100 | |
---------------------------------------|----------|----------|----------|----------|----------------|
All files | 93.58 | 83.32 | 90.7 | 93.86 | |
---------------------------------------|----------|----------|----------|----------|----------------|
=============================== Coverage summary ===============================
Statements : 93.58% ( 2290/2447 ), 2 ignored
Branches : 83.32% ( 884/1061 ), 1 ignored
Functions : 90.7% ( 478/527 ), 1 ignored
Lines : 93.86% ( 2263/2411 )
================================================================================
[11:00:53] Finished '<anonymous>' after 2.88 s
[11:00:53] Finished 'test' after 3.69 s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment