diff --git a/package-lock.json b/package-lock.json index 1292110c0..fb990c50d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "devDependencies": { "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", - "@firebolt-js/openrpc": "rdkcentral/firebolt-openrpc#major/rpc", + "@firebolt-js/openrpc": "../firebolt-openrpc", "@firebolt-js/schemas": "2.0.0", "@saithodev/semantic-release-backmerge": "^3.2.0", "@semantic-release/changelog": "^6.0.1", @@ -37,6 +37,37 @@ "typescript": "^4.6.4" } }, + "../firebolt-openrpc": { + "version": "3.0.0-next.4", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "ajv": "^8.12.0", + "ajv-formats": "^2.1.1", + "array.prototype.groupby": "^1.1.0", + "crocks": "^0.12.4", + "deepmerge": "^4.2.2", + "fs-extra": "^10.1.0", + "highland": "^2.13.5", + "mkdirp": "^0.5.6", + "node-fetch": "^3.2.10", + "nopt": "^5.0.0", + "util": "^0.12.4" + }, + "bin": { + "firebolt-openrpc": "src/cli.mjs" + }, + "devDependencies": { + "@commitlint/cli": "^17.1.2", + "@commitlint/config-conventional": "^17.1.0", + "@semantic-release/changelog": "^6.0.1", + "@semantic-release/git": "^10.0.1", + "@semantic-release/npm": "^9.0.1", + "husky": "^8.0.1", + "jest": "^27.3.1", + "semantic-release": "^19.0.5" + } + }, "node_modules/@ampproject/remapping": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", @@ -991,95 +1022,8 @@ "link": true }, "node_modules/@firebolt-js/openrpc": { - "version": "3.0.0-next.4", - "resolved": "git+ssh://git@github.com/rdkcentral/firebolt-openrpc.git#b13d4cd581d1e990f8d01a3bba285df3b3bef7f7", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "ajv": "^8.12.0", - "ajv-formats": "^2.1.1", - "array.prototype.groupby": "^1.1.0", - "crocks": "^0.12.4", - "deepmerge": "^4.2.2", - "fs-extra": "^10.1.0", - "highland": "^2.13.5", - "mkdirp": "^0.5.6", - "node-fetch": "^3.2.10", - "nopt": "^5.0.0", - "util": "^0.12.4" - }, - "bin": { - "firebolt-openrpc": "src/cli.mjs" - } - }, - "node_modules/@firebolt-js/openrpc/node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true - }, - "node_modules/@firebolt-js/openrpc/node_modules/ajv": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.16.0.tgz", - "integrity": "sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.3", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.4.1" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/@firebolt-js/openrpc/node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@firebolt-js/openrpc/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "node_modules/@firebolt-js/openrpc/node_modules/mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", - "dev": true, - "dependencies": { - "minimist": "^1.2.6" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/@firebolt-js/openrpc/node_modules/nopt": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", - "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", - "dev": true, - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": ">=6" - } + "resolved": "../firebolt-openrpc", + "link": true }, "node_modules/@firebolt-js/schemas": { "version": "2.0.0", @@ -2768,20 +2712,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array.prototype.groupby": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/array.prototype.groupby/-/array.prototype.groupby-1.1.0.tgz", - "integrity": "sha512-p+QtvmnNEBqajQWLG3kPls8cLPBfJgvayzc/qplsX8Vchtevtq+TR2gyav5xs5h+mdUjfgOvYoCdTsVxu3b5sA==", - "deprecated": "This proposal has been altered; please use https://npmjs.com/object.groupby instead!", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.2", - "es-shim-unscopables": "^1.0.0", - "get-intrinsic": "^1.1.1" - } - }, "node_modules/arraybuffer.prototype.slice": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", @@ -3416,12 +3346,6 @@ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "dev": true }, - "node_modules/crocks": { - "version": "0.12.4", - "resolved": "https://registry.npmjs.org/crocks/-/crocks-0.12.4.tgz", - "integrity": "sha512-paln6xJUrR9e/OWMFsyTi4dLyr+q99C5f7PQbGgSDHtwsfW0sCNZvnpHzvniI2dAE0uoBgeIP1Ukmme8Z0HxxA==", - "dev": true - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -3478,15 +3402,6 @@ "node": ">=8" } }, - "node_modules/data-uri-to-buffer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", - "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", - "dev": true, - "engines": { - "node": ">= 12" - } - }, "node_modules/data-urls": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", @@ -4928,29 +4843,6 @@ "bser": "2.1.1" } }, - "node_modules/fetch-blob": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", - "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "paypal", - "url": "https://paypal.me/jimmywarting" - } - ], - "dependencies": { - "node-domexception": "^1.0.0", - "web-streams-polyfill": "^3.0.3" - }, - "engines": { - "node": "^12.20 || >= 14.13" - } - }, "node_modules/figures": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", @@ -5077,18 +4969,6 @@ "node": ">= 6" } }, - "node_modules/formdata-polyfill": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", - "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "dev": true, - "dependencies": { - "fetch-blob": "^3.1.2" - }, - "engines": { - "node": ">=12.20.0" - } - }, "node_modules/from2": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", @@ -5542,15 +5422,6 @@ "node": ">= 0.4" } }, - "node_modules/highland": { - "version": "2.13.5", - "resolved": "https://registry.npmjs.org/highland/-/highland-2.13.5.tgz", - "integrity": "sha512-dn2flPapIIAa4BtkB2ahjshg8iSJtrJtdhEb9/oiOrS5HMQTR/GuhFpqJ+11YBdtnl3AwWKvbZd1Uxr8uAmA7A==", - "dev": true, - "dependencies": { - "util-deprecate": "^1.0.2" - } - }, "node_modules/hook-std": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/hook-std/-/hook-std-3.0.0.tgz", @@ -5810,22 +5681,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-array-buffer": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", @@ -5957,21 +5812,6 @@ "node": ">=6" } }, - "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -7584,25 +7424,6 @@ "integrity": "sha512-EZSPZB70jiVsivaBLYDCyntd5eH8NTSMOn3rB+HxwdmKThGELLdYv8qVIMWvZEFy9w8ZZpW9h9OB32l1rGtj7g==", "dev": true }, - "node_modules/node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "github", - "url": "https://paypal.me/jimmywarting" - } - ], - "engines": { - "node": ">=10.5.0" - } - }, "node_modules/node-emoji": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", @@ -7612,24 +7433,6 @@ "lodash": "^4.17.21" } }, - "node_modules/node-fetch": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", - "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", - "dev": true, - "dependencies": { - "data-uri-to-buffer": "^4.0.0", - "fetch-blob": "^3.1.4", - "formdata-polyfill": "^4.0.10" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/node-fetch" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -16879,19 +16682,6 @@ "requires-port": "^1.0.0" } }, - "node_modules/util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - } - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -16971,15 +16761,6 @@ "makeerror": "1.0.12" } }, - "node_modules/web-streams-polyfill": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", - "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/webidl-conversions": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", diff --git a/package.json b/package.json index 2b01b55a3..c26b31d6f 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "test": "npm run test:setup && NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest", "clean": "rm -rf dist && npm run clean --workspaces", "dist": "npm run fs:setup && npm run validate:each && npm run compile && npm run specification && npm run version && npm run dist:notest --workspaces && npm run test", - "specification": "node ./src/js/version-specification/index.mjs --source ./src/json/firebolt-specification.json", + "specification": "node ./src/js/version-specification/index.mjs --source ./src/json/firebolt-specification.json --legacy-versions 0", "specification:report": "node ./src/js/version-specification/index.mjs --source ./dist/firebolt-specification.json --report", "version": "node ./src/js/version.mjs sync", "dev:setup": "husky install", @@ -46,7 +46,7 @@ "devDependencies": { "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", - "@firebolt-js/openrpc": "rdkcentral/firebolt-openrpc#major/rpc", + "@firebolt-js/openrpc": "../firebolt-openrpc", "@firebolt-js/schemas": "2.0.0", "@saithodev/semantic-release-backmerge": "^3.2.0", "@semantic-release/changelog": "^6.0.1", diff --git a/src/js/version-specification/index.mjs b/src/js/version-specification/index.mjs index ec7c03b8e..4c0abe565 100644 --- a/src/js/version-specification/index.mjs +++ b/src/js/version-specification/index.mjs @@ -9,7 +9,7 @@ const loadJson = file => readFile(file).then(data => JSON.parse(data.toString()) const knownOpts = { 'capabilities': [Boolean], - 'legacy-support': [Number], + 'legacy-versions': [Number], 'source': [String], 'report': [Boolean] } @@ -22,7 +22,7 @@ const defaultOpts = { } const shortHands = { - 'l': '--legacy-versions', + 'l': '--legacy-version', 'c': '--capabilities', 't': '--target', 's': '--source', diff --git a/src/sdks/core/test/suite/federation.test.ts b/src/sdks/core/test/suite/federation.test.ts index 120e1030a..41bf84968 100644 --- a/src/sdks/core/test/suite/federation.test.ts +++ b/src/sdks/core/test/suite/federation.test.ts @@ -25,7 +25,7 @@ import { Lifecycle, Discovery, Entertainment, Types } from '../../build/javascri // holds test transport layer state, e.g. callback const state = { - callback:(a:object) => {} + callback:(a:string) => {} } let pullEntityInfoListenCount = 0 @@ -40,7 +40,8 @@ let secondRegistrationFailed = false beforeAll(() => { return new Promise( (resolve, reject) => { const transport = { - send: function(json: any) { + send: function(message: string) { + const json = JSON.parse(message) sendCalled = true if (json.method.toLowerCase() === 'discovery.onpullentityinfo') { // we'll assert on this later... @@ -58,7 +59,7 @@ beforeAll(() => { } // catching errors, so all tests don't fail if this breaks try { - state.callback(response) + state.callback(JSON.stringify(response)) } catch (err) { throw err @@ -81,9 +82,9 @@ beforeAll(() => { } } - state.callback(response) + state.callback(JSON.stringify(response)) - state.callback({ + state.callback(JSON.stringify({ jsonrpc: '2.0', method: 'Discovery.pullEntityInfo', params: { @@ -94,7 +95,7 @@ beforeAll(() => { } } } - }) + })) } catch (err) { throw err @@ -116,15 +117,15 @@ beforeAll(() => { } setTimeout(() => { - state.callback({ + state.callback(JSON.stringify({ jsonrpc: '2.0', id: json.id, result: true - }) + })) }, 100) } }, - receive: function(callback: (a:object) => void) { + receive: function(callback: (a:string) => void) { // store the callback state.callback = callback } diff --git a/src/sdks/core/test/suite/lazy-transport.test.ts b/src/sdks/core/test/suite/lazy-transport.test.ts index 5b9c8abd0..04551a741 100644 --- a/src/sdks/core/test/suite/lazy-transport.test.ts +++ b/src/sdks/core/test/suite/lazy-transport.test.ts @@ -71,7 +71,8 @@ let callbackWiredUp = false let sendCalled = false const transport = { - send: function(json) { + send: function(message: string) { + const json = JSON.parse(message) sendCalled = true if (json.method === 'Lifecycle.provideApplication') { // we'll assert on this later... @@ -87,7 +88,7 @@ const transport = { // catching errors, so all tests don't fail if this breaks try { // send back the onInactive event immediately, to test for race conditions - state.callback(response) + state.callback(JSON.stringify(response)) } catch (err) { // fail silenetly (the boolean-based tests below will figure it out...) diff --git a/src/sdks/core/test/suite/listeners-transport.test.ts b/src/sdks/core/test/suite/listeners-transport.test.ts index 08dfa3d89..3cfbc8d63 100644 --- a/src/sdks/core/test/suite/listeners-transport.test.ts +++ b/src/sdks/core/test/suite/listeners-transport.test.ts @@ -18,30 +18,59 @@ const win = globalThis || window; -import { test, expect } from "@jest/globals"; +import { test, expect, beforeAll } from "@jest/globals"; +import { Settings, Lifecycle, Discovery, Intents } from "../../build/javascript/src/firebolt"; // holds test transport layer state, e.g. callback const state = { callback: Function, }; +let transportAlreadyExisted = false; let navigateToListenCount: number = 0; let callbackWiredUp: boolean = false; let sendCalled: boolean = false; -const transport = { - send: function (json: any) { - sendCalled = true; - if (json.method.toLowerCase() === "discovery.onnavigateto") { - // we'll assert on this later... - navigateToListenCount++; - if (state.callback) { +beforeAll( async () => { + Settings.setLogLevel('DEBUG') + const transport = { + send: function (message: string) { + const json = JSON.parse(message) + console.dir(json) + sendCalled = true; + if (json.method && json.params?.listen === true) { + if (state.callback) { + // we'll assert on this later... + callbackWiredUp = true; + let response = { + jsonrpc: "2.0", + id: json.id, + result: { + listening: true, + event: json.method + } + }; + // catching errors, so all tests don't fail if this breaks + try { + // send back the onInactive event immediately, to test for race conditions + state.callback(JSON.stringify(response)); + } catch (err) { + // fail silenetly (the boolean-based tests below will figure it out...) + } + } + } + + if (json.method === 'Discovery.onNavigateTo') { // we'll assert on this later... - callbackWiredUp = true; + navigateToListenCount++; let response = { jsonrpc: "2.0", - id: json.id, - result: true, + method: "Discovery.navigateTo", + params: { + value: { + action: "home" + } + } }; // catching errors, so all tests don't fail if this breaks try { @@ -51,37 +80,49 @@ const transport = { // fail silenetly (the boolean-based tests below will figure it out...) } } - } - }, - receive: function (callback: FunctionConstructor) { - // store the callback - state.callback = callback; - }, -}; + }, + receive: function (callback: FunctionConstructor) { + // store the callback + state.callback = callback; + callbackWiredUp = true + console.log(`receive`) + }, + }; + + win.__firebolt = win.__firebolt || {} + transportAlreadyExisted = !!win.__firebolt.transport + + win.__firebolt = { + transport + } -win.__firebolt = win.__firebolt || {} -const transportAlreadyExisted = !!win.__firebolt.transport + console.log('0') -win.__firebolt = { - transport -} + // listen twice, using event-specific call FIRST + await Discovery.listen("navigateTo", (value: Intents.NavigationIntent) => { + callbackWiredUp = true; + }); -import { Lifecycle, Discovery, Intents } from "../../build/javascript/src/firebolt"; + console.log('1') -// listen twice, using event-specific call FIRST -Discovery.listen("navigateTo", (value: Intents.NavigationIntent) => { - callbackWiredUp = true; -}); + await Discovery.listen("navigateTo", (value: Intents.NavigationIntent) => { + /* this just adds more listen calls to make sure we don't spam */ + }); -Discovery.listen("navigateTo", (value: Intents.NavigationIntent) => { - /* this just adds more listen calls to make sure we don't spam */ -}); -Discovery.listen((event: string, value: object) => { - /* testing both listen signatures */ -}); -Discovery.listen((event: string, value: object) => { - /* testing both listen signatures */ -}); + console.log('2') + + await Discovery.listen((event: string, value: object) => { + /* testing both listen signatures */ + }); + + console.log('3') + + await Discovery.listen((event: string, value: object) => { + /* testing both listen signatures */ + }); + + console.log(`end of beforeAll!`) +}) //Lifecycle.ready(); diff --git a/src/sdks/core/test/suite/synchronous-transport.test.ts b/src/sdks/core/test/suite/synchronous-transport.test.ts index e5daef94e..accbca64e 100644 --- a/src/sdks/core/test/suite/synchronous-transport.test.ts +++ b/src/sdks/core/test/suite/synchronous-transport.test.ts @@ -25,7 +25,8 @@ let firstId: Number win.__firebolt = { transport: { - send: function(json: any) { + send: function(message: string) { + const json = JSON.parse(message) if (firstId === undefined) { firstId = json.id } @@ -36,11 +37,11 @@ win.__firebolt = { else if (json.method === 'Device.name') { console.dir(json) _callback && setTimeout(() => { - _callback({ - jsonrpc: '2.0', - id: json.id, - result: 'Test Name' - }) + _callback(JSON.stringify({ + jsonrpc: '2.0', + id: json.id, + result: 'Test Name' + })) }, 100) } },