Skip to content

Test from color-picker-tutorial doesn't work #62

Open
@DracotMolver

Description

@DracotMolver

Hi. I'm following the Color picker tutorial and I've got to the test part.
I think it might be how the context render the output.

This is how I have my folders structure:

/src
   |__/components
       |__/color-picker
           |__/components
              |__/color-picker-header
                  |__/test
                      |__test.js

Then, in my test.js file, I have this:

const expect = require('chai').expect;

test('color-picker-header color', function (context) {
    const output = context.render({
        color: '#000000'
    });
    expect(output.$('div').attr('style')).to.contain('background-color:#000000');
});

So, running the test, I've got the next error:

AssertionError: object tested must be an array, a map, an object, a set, a string, or a weakset, but undefined given

To see what was happening, I used the html function from Cheerio; the result:

const html = output.$.html();
// <body>[object Object]</body>

I'm not sure, if that output is correct; I mean, if is espected. But, doing the same using output.$('div') I've got initialize(0).

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions