rdkcentral/mock-firebolt

update library state to override default parameters.initialization

Opened this issue · 1 comments

Hello you all! I'm using this awesome library some days ago, this works pretty well in some tests I did, Now I'm trying to get the data inside a navigateTo param when my app is NOT running. I'm using the firebolt Prameters module to get that data.

To do so, I'm trying to override the default mock value for parameters.initialization by uploading my parameters-initialization.json which contains the following json

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "parameters.initialization",
  "result": {
    "lmt": 0,
    "us_privacy": "1-Y-",
    "discovery": {
      "navigateTo": {
        "action": "playback",
        "context": {
            "source": "device"
        },
        "data": {
          "entityType": "program",
          "programType": "movie",
          "entityId": "my-entity-id"
        }
      }
    }
  }
}

this is the executed command node cli.mjs --upload ../examples/parameters-initialization.json

The update seems to be well since the cli says { status: 'SUCCESS' } and the server says "Updating state for default user 12345" (my app is working with the default user) but when I reload my app I'm getting the default data again and again :(

After updating the state of mock-firebolt and reloading my app I'm getting the default data:

{
  "navigateTo": {
    "action": "entity",
    "data": {
      "entityId": "abc",
      "entityType": "program",
      "programType": "movie"
    },
    "context": {
      "source": "voice"
    }
  }
}

I want mock-firebolt to get the data in my app as I defined in the library state, something like this:

{
  "navigateTo": {
    "action": "playback",
    "context": {
      "source": "device"
    },
    "data": {
      "entityType": "program",
      "programType": "movie",
      "entityId": "my-entity-id"
    }
  }
}

Could you help me please?

Hey, I found a solution for this, I just used a yaml file instead json to update the mock-firebolt state, my app is working now with this

command:

node cli.mjs --upload ../examples/parameters-initialization-playback.yaml

examples/parameters-initialization-playback.yaml:

---
methods:
  parameters.initialization:
    response: |
      function f(ctx, params) {
        const result = {"discovery":{"navigateTo":{"action":"playback","data":{"entityId":"my-entity-id","entityType":"program","programType":"movie"},"context":{"source":"device"}}}};
        return result;
      }