Skip to content

Commit

Permalink
chore(snc): remove snc violations from parse-props.spec (#4402)
Browse files Browse the repository at this point in the history
this commit updates the test for prop parsing via `transpileModule` to
account for the fact that returned fields may be `undefined`
  • Loading branch information
rwaskiewicz authored May 22, 2023
1 parent 0b66a0b commit 21199d6
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions src/compiler/transformers/test/parse-props.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ describe('parse props', () => {
},
});

expect(t.property.attribute).toBe('val');
expect(t.property.type).toBe('string');
expect(t.property.optional).toBe(true);
expect(t.cmp.hasProp).toBe(true);
expect(t.property?.attribute).toBe('val');
expect(t.property?.type).toBe('string');
expect(t.property?.optional).toBe(true);
expect(t.cmp?.hasProp).toBe(true);
});

it('prop required', () => {
Expand Down Expand Up @@ -60,7 +60,7 @@ describe('parse props', () => {
type: 'string',
},
});
expect(t.property.required).toBe(true);
expect(t.property?.required).toBe(true);
});

it('prop mutable', () => {
Expand Down Expand Up @@ -90,7 +90,7 @@ describe('parse props', () => {
type: 'string',
},
});
expect(t.property.mutable).toBe(true);
expect(t.property?.mutable).toBe(true);
});

it('prop reflectAttr', () => {
Expand Down Expand Up @@ -119,8 +119,8 @@ describe('parse props', () => {
type: 'string',
},
});
expect(t.property.reflect).toBe(true);
expect(t.cmp.hasReflect).toBe(true);
expect(t.property?.reflect).toBe(true);
expect(t.cmp?.hasReflect).toBe(true);
});

it('prop array', () => {
Expand All @@ -147,9 +147,9 @@ describe('parse props', () => {
type: 'unknown',
},
});
expect(t.property.type).toBe('unknown');
expect(t.property.attribute).toBe(undefined);
expect(t.property.reflect).toBe(false);
expect(t.property?.type).toBe('unknown');
expect(t.property?.attribute).toBe(undefined);
expect(t.property?.reflect).toBe(false);
});

it('prop object', () => {
Expand Down Expand Up @@ -182,9 +182,9 @@ describe('parse props', () => {
type: 'any',
},
});
expect(t.property.type).toBe('any');
expect(t.property.attribute).toBe('val');
expect(t.property.reflect).toBe(false);
expect(t.property?.type).toBe('any');
expect(t.property?.attribute).toBe('val');
expect(t.property?.reflect).toBe(false);
});

it('prop multiword', () => {
Expand Down Expand Up @@ -214,8 +214,8 @@ describe('parse props', () => {
type: 'string',
},
});
expect(t.property.name).toBe('multiWord');
expect(t.property.attribute).toBe('multi-word');
expect(t.property?.name).toBe('multiWord');
expect(t.property?.attribute).toBe('multi-word');
});

it('prop w/ string type', () => {
Expand Down Expand Up @@ -244,8 +244,8 @@ describe('parse props', () => {
type: 'string',
},
});
expect(t.property.type).toBe('string');
expect(t.property.attribute).toBe('val');
expect(t.property?.type).toBe('string');
expect(t.property?.attribute).toBe('val');
});

it('prop w/ number type', () => {
Expand Down Expand Up @@ -274,8 +274,8 @@ describe('parse props', () => {
type: 'number',
},
});
expect(t.property.type).toBe('number');
expect(t.property.attribute).toBe('val');
expect(t.property?.type).toBe('number');
expect(t.property?.attribute).toBe('val');
});

it('prop w/ boolean type', () => {
Expand Down Expand Up @@ -304,8 +304,8 @@ describe('parse props', () => {
type: 'boolean',
},
});
expect(t.property.type).toBe('boolean');
expect(t.property.attribute).toBe('val');
expect(t.property?.type).toBe('boolean');
expect(t.property?.attribute).toBe('val');
});

it('prop w/ any type', () => {
Expand Down Expand Up @@ -334,8 +334,8 @@ describe('parse props', () => {
type: 'any',
},
});
expect(t.property.type).toBe('any');
expect(t.property.attribute).toBe('val');
expect(t.property?.type).toBe('any');
expect(t.property?.attribute).toBe('val');
});

it('prop w/ inferred string type', () => {
Expand Down Expand Up @@ -365,8 +365,8 @@ describe('parse props', () => {
type: 'string',
},
});
expect(t.property.type).toBe('string');
expect(t.property.attribute).toBe('val');
expect(t.property?.type).toBe('string');
expect(t.property?.attribute).toBe('val');
});

it('prop w/ inferred number type', () => {
Expand Down Expand Up @@ -396,8 +396,8 @@ describe('parse props', () => {
type: 'number',
},
});
expect(t.property.type).toBe('number');
expect(t.property.attribute).toBe('val');
expect(t.property?.type).toBe('number');
expect(t.property?.attribute).toBe('val');
});

it('prop w/ inferred boolean type', () => {
Expand Down Expand Up @@ -427,8 +427,8 @@ describe('parse props', () => {
type: 'boolean',
},
});
expect(t.property.type).toBe('boolean');
expect(t.property.attribute).toBe('val');
expect(t.property?.type).toBe('boolean');
expect(t.property?.attribute).toBe('val');
});

it('prop w/ inferred any type from null', () => {
Expand Down Expand Up @@ -459,7 +459,7 @@ describe('parse props', () => {
type: 'any',
},
});
expect(t.property.type).toBe('any');
expect(t.property.attribute).toBe('val');
expect(t.property?.type).toBe('any');
expect(t.property?.attribute).toBe('val');
});
});

0 comments on commit 21199d6

Please sign in to comment.