Skip to content

[other] add to readme local run steps #80

[other] add to readme local run steps

[other] add to readme local run steps #80

GitHub Actions / Unit Tests succeeded Dec 18, 2024 in 0s

155 passed, 0 failed and 7 skipped

Tests passed successfully

✅ test-results.json

162 tests were completed in 54ms with 155 passed, 0 failed and 7 skipped.

Test suite Passed Failed Skipped Time
test/0_config.js 7✅ 0ms
test/0_queue.js 2✅ 0ms
test/1_utils.js 122✅ 7⚪ 28ms
test/6_branch_new.js 17✅ 4ms
test/journeys_utils.js 7✅ 1ms

✅ test/0_config.js

config api_endpoint
  ✅ api_endpoint should be defined
  ✅ api_endpoint value is correct
config app_service_endpoint
  ✅ app_service_endpoint should be defined
  ✅ app_service_endpoint value is correct
config link_service_endpoint
  ✅ link_service_endpoint should be defined
  ✅ link_service_endpoint value is correct
config version
  ✅ version should be defined

✅ test/0_queue.js

task_queue
  ✅ should enqueue two functions, and call them in order
  ✅ should queue a function and call it

✅ test/1_utils.js

utils addPropertyIfNotNullorEmpty
  ✅ should add property if value is not empty
  ✅ should not add property if value is empty
  ✅ should not add property if value is null
utils base64encode
  ✅ should encode a string
utils cleanLinkData
  ✅ should accept empty linkData
  ✅ should not stringify pre-stringified field "data"
  ✅ should stringify field "data" and add "source"
utils convertObjectValuesToString
  ✅ a complex object's values should be stringified
  ✅ a simple object's values should be stringified
  ✅ should return empty object
utils convertValueToString
  ✅ should stringify a boolean
  ✅ should stringify a number
  ✅ should stringify an array
  ✅ should stringify an object
  ✅ should stringify null
utils delay function
  ✅ calls synchronously for a negative delay argument
  ✅ calls synchronously for a non-numeric delay argument
  ✅ calls synchronously for a zero delay argument
  ✅ delays for any positive numeric argument
utils extractDeeplinkPath
  ✅ should return deeplink path for a url with implicit protocol
  ✅ should return deeplink path for an https:// url
  ✅ should return empty string if there is no deeplink path
utils extractMobileDeeplinkPath
  ✅ should return a deeplink path if "/" is prepended
  ✅ should return deeplink path if no protocol is given
  ✅ should return deeplink path mobile scheme url
  ✅ should return empty string if there is no deeplink path
utils getClickIdAndSearchStringFromLink
  ✅ If "" is passed in, "" should be returned"
  ✅ If "http://example.com:3000?test=test" is passed in, ?test=test should be returned"
  ✅ If "http://example.com:3000/?test=test" is passed in, ?test=test should be returned"
  ✅ If "http://example.com:3000/c/clickid?search=test#hash" is passed in, clickid?search=test should be returned"
  ✅ If "http://example.com:3000/c/clickid/?search=test#hash" is passed in, clickid?search=test should be returned"
  ✅ If {} is passed in, "" should be returned"
  ⚪ If /123abc is passed in, 123abc should be returned"
  ⚪ If /c/123abc is passed in, 123abc should be returned"
  ⚪ If /c/123abc?key1=val1 is passed in, 123abc?key1=val1 should be returned"
  ✅ If null is passed in, "" should be returned"
  ✅ If undefined is passed in, "" should be returned"
utils getHostedDeepLinkData
  ✅ $ios_deeplink_path and $android_deeplink_path should be formed from hosted metadata
  ✅ $ios_deeplink_path and $android_deeplink_path should be formed from twitter tags
  ✅ $ios_deeplink_path and $android_deeplink_path should be formed from twitter tags. $deeplink_path should also be present
  ✅ $ios_deeplink_path should be formed from applinks tag and $android_deeplink_path from hosted metadata tag
  ✅ Original key:value pairs in params should be present
  ⚪ should find applink, twitter and branch hosted data on page
  ✅ should return an object
  ⚪ should return OG tags
utils getParamValue
  ✅ should return search param value
  ✅ should return undefined if not set
utils getPlatformByUserAgent
  ✅ should return "android" for Android chrome user agent
  ✅ should return "desktop" for linux chrome user agent
  ✅ should return "desktop" for macOS chrome user agent
  ✅ should return "desktop" for macOS safari user agent
  ✅ should return "desktop" for windows chrome user agent
  ✅ should return "desktop" for windows edge user agent
  ✅ should return "ios" for ios chrome user agent
  ✅ should return "ios" for ios safari user agent
  ✅ should return "ipad" for iOS ipad safari user agent
utils hashValue
  ✅ should return hash param value
  ✅ should return undefined if not set
utils isIOSWKWebView function
  ✅ should return false for Chrome
  ✅ should return false for Edge
  ✅ should return false for Firefox
  ✅ should return false for Opera
  ✅ should return false for Yandex
  ✅ should return false when UA is iOS but window.webkitURL is not defined
  ✅ should return false when UA is not iOS but window.webkitURL is defined
  ✅ should return true when UA includes iPad & window.webkitURL is defined
  ✅ should return true when UA includes iPhone & window.webkitURL is defined
  ✅ should return true when UA includes iPod & window.webkitURL is defined
utils isSafari11OrGreater
  ✅ should return false for non safari browsers
  ✅ should return true for safari 11 browsers
utils isValidUrl
  ✅ should return false for empty url
  ✅ should return false for Invalid domain names
  ✅ should return false for Invalid domain names 2
  ✅ should return false for Invalid domain names 2
  ✅ should return false for invalid path
  ✅ should return false for invalid scheme htt
  ✅ should return false for missing domain
  ✅ should return false for missing domain after dot
  ✅ should return false for missing domain before dot
  ✅ should return false for missing scheme
  ✅ should return false for null
  ✅ should return false for undefined
  ✅ should return true for valid url - http
  ✅ should return true for valid url - https
utils isWebKitBrowser function
  ✅ returns false when window.webkitURL is not defined
  ✅ returns true when window.webkitURL is defined
utils merge
  ✅ should handle an non-object for first argument
  ✅ should handle an non-object for second argument
  ✅ should merge two objects despite duplication
utils mergeMetadataFromInitToHostedMetadata
  ✅ ensure that additionalMetadata['hosted_deeplink_data'] does not get mutated
  ✅ ensure that userSuppliedMetadata does not get mutated
  ⚪ merge hosted_deeplink_data and user-supplied metadata
  ⚪ override previous hosted_deeplink_data keys via user-supplied metadata object
  ✅ tests with metadata and without hosted_deeplink_data
utils message
  ✅ should produce a Branch SDK already init message
  ✅ should produce a Branch SDK not init message
  ✅ should produce a call branch init first
  ✅ should produce a missing app id
  ✅ should produce a missing identity error
  ✅ should produce a missing param message
  ✅ should produce a missing URL error
  ✅ should produce a timeout message
  ✅ should produce an invalid param type message
utils removeTrailingDotZeros
  ✅ multi-dot : should return string with trailing dot zeros stripped
  ✅ no dot- should not strip trailing dot zero
  ✅ should not strip trailing dot zero
  ✅ should return empty if value is empty
  ✅ should return null if value is null
  ✅ single dot- should not strip trailing dot zero
  ✅ with dot and no zeros- should not strip trailing dot zero
utils separateEventAndCustomData
  ✅ extracted custom and event data should equal initial objects
  ✅ should return true or false for a given parameter and type
  ✅ utils.isStandardEvent() should return true for standard events and false for custom events
utils setDMAParams
  ✅ should add DMA parameters for valid endpoints: v1/open
  ✅ should add DMA parameters for valid endpoints: v1/pageview
  ✅ should add DMA parameters for valid endpoints: v2/event/custom
  ✅ should add DMA parameters for valid endpoints: v2/event/custom
  ✅ should add DMA parameters for valid endpoints: v2/event/standard
  ✅ should not add DMA parameters for invalid endpoints: v1/dismiss
  ✅ should not add DMA parameters for invalid endpoints: v1/invalid
utils shouldAddDMAParams
  ✅ should return false for invalid endpoints
  ✅ should return true for valid endpoints
utils Tests for utils.userPreferences.shouldBlockRequest()
  ✅ should allow raw links
  ✅ should return false with v1/open as url endpoint and valid request data provided
  ✅ should return true with v1/bogus as url endpoint
  ✅ should return true with v1/open as url endpoint and no request data provided
  ✅ should return true with v1/xyz as url endpoint and with bogus request data
utils whiteListSessionData
  ✅ should make missing params null
  ✅ should remove unwanted params

✅ test/6_branch_new.js

Branch - new addListener
  ✅ should fire listener added using addListener for an event
Branch - new getAPIUrl
  ✅ test method exists
  ✅ test url
Branch - new referringLink
  ✅ test method exists
Branch - new setAPIUrl
  ✅ test method exists
Branch - new setDMAParamsForEEA
  ✅ should catch and log exception
  ✅ should log warning if adPersonalizationConsent is not boolean
  ✅ should log warning if eeaRegion is not boolean
  ✅ should log warning if eeaRegion is not boolean
  ✅ should not store dma params inside branch_dma_data of storage if eeaRegion is not set
  ✅ should not store dma params inside branch_dma_data of storage if eeaRegion is null
  ✅ should store dma params inside branch_dma_data of storage
  ✅ test method exists
Branch - new setRequestMetaData
  ✅ should delete metadata for a key when value is null
  ✅ should not modify metadata for an invalid key or undefined value
  ✅ should set metadata for a valid key and value
  ✅ test method exists

✅ test/journeys_utils.js

getRelativeHeightValueOrFalseFromBannerHeight
  ✅ should return false when bannerHeight is in pixel values
  ✅ should return the height value when bannerHeight is provided with percentage units - 100%
  ✅ should return the height value when bannerHeight is provided with percentage units - 5%
  ✅ should return the height value when bannerHeight is provided with percentage units - 99%
  ✅ should return the height value when bannerHeight is provided with viewHeight units - 100vh
  ✅ should return the height value when bannerHeight is provided with viewHeight units - 5vh
  ✅ should return the height value when bannerHeight is provided with viewHeight units - 99vh