Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateObject returns Invalid #128

Open
xgouchet opened this issue Aug 22, 2022 · 0 comments
Open

CreateObject returns Invalid #128

xgouchet opened this issue Aug 22, 2022 · 0 comments

Comments

@xgouchet
Copy link

I'm trying to test a custom component, using the following code:

  • components/MyComponent.xml:
<component name="MyComponent" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://devtools.web.roku.com/schema/RokuSceneGraph.xsd">
    <script type="text/brightscript" uri="pkg:/components/MyComponent.brs" />
</component>
  • components/MyComponent.brs:
function init()
    print "init() called"
end function
  • tests/MyComponent.test.brs:
function main(args as object) as object
    return roca(args).describe("A sample test suite", sub()
        m.it("has a task", sub()
            test = CreateObject("roSGNode", "MyComponent")
            m.assert.isValid(test, "Should be valid")
        end sub)
    end sub)
end function

Running the test always fails with the following output:

      m.assert.isValid: Should be valid
      + expected - actual

      -null
      +non-invalid
      
      at m.assert.isValid (src/tests/MyComponent.test.brs:5:12)

Whenever I try creating another type of object, for instance CreateObject("roDeviceInfo"), then the test succeeds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant