Skip to content

Commit

Permalink
Update ComponentDescriptorH to test all fixtures
Browse files Browse the repository at this point in the history
Summary: This test didn't get updated to run over all the fixtures like the others

Reviewed By: JoshuaGross

Differential Revision: D16501494

fbshipit-source-id: 4a68d60819701a9de7f1da22a66ccf807cc4490f
  • Loading branch information
elicwhite authored and facebook-github-bot committed Jul 31, 2019
1 parent 8f055a0 commit d6d7181
Show file tree
Hide file tree
Showing 2 changed files with 191 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,85 +11,17 @@

'use strict';

const fixtures = require('../__test_fixtures__/fixtures.js');
const generator = require('../GenerateComponentDescriptorH.js');

const {
ARRAY_PROPS,
BOOLEAN_PROP,
STRING_PROP,
INTEGER_PROPS,
FLOAT_PROPS,
COLOR_PROP,
IMAGE_PROP,
POINT_PROP,
MULTI_NATIVE_PROP,
ENUM_PROP,
EVENT_PROPS,
TWO_COMPONENTS_SAME_FILE,
TWO_COMPONENTS_DIFFERENT_FILES,
} = require('../__test_fixtures__/fixtures.js');

describe('GenerateComponentDescriptorH', () => {
it('can generate a array props', () => {
expect(generator.generate('ARRAY_PROPS', ARRAY_PROPS)).toMatchSnapshot();
});

it('can generate a single boolean prop', () => {
expect(generator.generate('BOOLEAN_PROP', BOOLEAN_PROP)).toMatchSnapshot();
});

it('can generate a single string prop', () => {
expect(generator.generate('STRING_PROPS', STRING_PROP)).toMatchSnapshot();
});

it('can generate integer props', () => {
expect(
generator.generate('INTEGER_PROPS', INTEGER_PROPS),
).toMatchSnapshot();
});

it('can generate float props', () => {
expect(generator.generate('FLOAT_PROPS', FLOAT_PROPS)).toMatchSnapshot();
});

it('can generate a single native primitive prop', () => {
expect(generator.generate('COLOR_PROP', COLOR_PROP)).toMatchSnapshot();
});

it('can generate a native primitive image prop', () => {
expect(generator.generate('IMAGE_PROP', IMAGE_PROP)).toMatchSnapshot();
});

it('can generate a native primitive point prop', () => {
expect(generator.generate('IMAGE_PROP', POINT_PROP)).toMatchSnapshot();
});

it('can generate multiple native props', () => {
expect(
generator.generate('MULTI_NATIVE_PROP', MULTI_NATIVE_PROP),
).toMatchSnapshot();
});

it('can generate enum props', () => {
expect(generator.generate('ENUM_PROP', ENUM_PROP)).toMatchSnapshot();
});

it('can generate events', () => {
expect(generator.generate('EVENT_PROPS', EVENT_PROPS)).toMatchSnapshot();
});

it('supports two components from same module', () => {
expect(
generator.generate('TWO_COMPONENTS_SAME_FILE', TWO_COMPONENTS_SAME_FILE),
).toMatchSnapshot();
});

it('supports two components from different modules', () => {
expect(
generator.generate(
'TWO_COMPONENTS_DIFFERENT_FILES',
TWO_COMPONENTS_DIFFERENT_FILES,
),
).toMatchSnapshot();
});
Object.keys(fixtures)
.sort()
.forEach(fixtureName => {
const fixture = fixtures[fixtureName];

it(`can generate fixture ${fixtureName}`, () => {
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
});
});
});
Loading

0 comments on commit d6d7181

Please sign in to comment.