@webex/calling 3.12.0-next.51 → 3.12.0-next.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1986,4 +1986,83 @@ describe('uploadLogs', function () {
1986
1986
  }, _callee23);
1987
1987
  })));
1988
1988
  });
1989
+ describe('resolveCallingBackend', function () {
1990
+ var createDevice = function createDevice(callingBehavior, entitlementKeys) {
1991
+ return {
1992
+ url: 'https://wdm.example.com/devices/123',
1993
+ userId: 'user-id',
1994
+ orgId: 'org-id',
1995
+ version: '1.0',
1996
+ callingBehavior: callingBehavior,
1997
+ features: {
1998
+ developer: {
1999
+ models: [],
2000
+ get: jest.fn()
2001
+ },
2002
+ entitlement: {
2003
+ models: entitlementKeys.map(function (key) {
2004
+ return {
2005
+ _values: {
2006
+ key: key
2007
+ }
2008
+ };
2009
+ })
2010
+ }
2011
+ }
2012
+ };
2013
+ };
2014
+ it.each([['bc-sp-basic', _types.CALLING_BACKEND.WXC], ['bc-sp-standard', _types.CALLING_BACKEND.WXC]])('returns WXC when callingBehavior is NATIVE_WEBEX_TEAMS_CALLING and entitlement is %s', function (entitlement, expected) {
2015
+ var device = createDevice('NATIVE_WEBEX_TEAMS_CALLING', [entitlement]);
2016
+ expect((0, _Utils.resolveCallingBackend)(device)).toBe(expected);
2017
+ });
2018
+ it('returns BWRKS when callingBehavior is NATIVE_WEBEX_TEAMS_CALLING and entitlement is broadworks-connector', function () {
2019
+ var device = createDevice('NATIVE_WEBEX_TEAMS_CALLING', ['broadworks-connector']);
2020
+ expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.BWRKS);
2021
+ });
2022
+ it('returns UCM when callingBehavior is NATIVE_SIP_CALL_TO_UCM', function () {
2023
+ var device = createDevice('NATIVE_SIP_CALL_TO_UCM', []);
2024
+ expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.UCM);
2025
+ });
2026
+ it('returns INVALID when callingBehavior is unknown', function () {
2027
+ var device = createDevice('UNKNOWN_BEHAVIOR', []);
2028
+ expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.INVALID);
2029
+ });
2030
+ it('returns INVALID when callingBehavior is NATIVE_WEBEX_TEAMS_CALLING but no matching entitlement', function () {
2031
+ var device = createDevice('NATIVE_WEBEX_TEAMS_CALLING', ['some-other-entitlement']);
2032
+ expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.INVALID);
2033
+ });
2034
+ it('matches the first qualifying entitlement when multiple are present', function () {
2035
+ var device = createDevice('NATIVE_WEBEX_TEAMS_CALLING', ['broadworks-connector', 'bc-sp-basic']);
2036
+ expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.BWRKS);
2037
+ });
2038
+ });
2039
+ describe('getCallingBackEnd', function () {
2040
+ it('passes webex.internal.device to resolveCallingBackend and returns its result', function () {
2041
+ var device = {
2042
+ url: 'https://wdm.example.com/devices/123',
2043
+ userId: 'user-id',
2044
+ orgId: 'org-id',
2045
+ version: '1.0',
2046
+ callingBehavior: 'NATIVE_SIP_CALL_TO_UCM',
2047
+ features: {
2048
+ developer: {
2049
+ models: [],
2050
+ get: jest.fn()
2051
+ },
2052
+ entitlement: {
2053
+ models: []
2054
+ }
2055
+ }
2056
+ };
2057
+ var mockWebex = {
2058
+ internal: {
2059
+ device: device
2060
+ }
2061
+ };
2062
+ var result = (0, _Utils.getCallingBackEnd)(mockWebex);
2063
+ expect(result).toBe((0, _Utils.resolveCallingBackend)(device));
2064
+ expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.UCM);
2065
+ expect(result).toBe(_types.CALLING_BACKEND.UCM);
2066
+ });
2067
+ });
1989
2068
  //# sourceMappingURL=Utils.test.js.map