Skip to content

Commit

Permalink
test(core): clean up unnecessary nesting in old tests (#52239)
Browse files Browse the repository at this point in the history
A lot of our tests are wrapped in `{}` which serves no purpose, aside from increasing the nesting level and, in some cases, causing confusion. The braces appear to be a leftover from a time when all tests were wrapped in a `function main() {}`. The function declaration was removed in #21053, but the braces remained, presumably because it was easier to search&replace for `function main()`, but not to remove the braces at the same time.

PR Close #52239
  • Loading branch information
crisbeto authored and dylhunn committed Oct 19, 2023
1 parent cfd89b0 commit c078056
Show file tree
Hide file tree
Showing 114 changed files with 27,740 additions and 28,137 deletions.
93 changes: 46 additions & 47 deletions packages/animations/browser/test/dsl/animation_ast_builder_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,54 +10,53 @@ import {AnimationMetadata, AnimationMetadataType} from '@angular/animations';
import {buildAnimationAst} from '../../src/dsl/animation_ast_builder';
import {MockAnimationDriver} from '../../testing';

{
describe('buildAnimationAst', () => {
it('should build the AST without any errors and warnings', () => {
const driver = new MockAnimationDriver();
const errors: Error[] = [];
const warnings: string[] = [];
const animationAst = buildAnimationAst(
driver, <AnimationMetadata>{
animation: [{
styles: {
offset: null,
styles: {backgroundColor: '#000'},
type: AnimationMetadataType.Style
},
timings: {delay: 0, duration: 1000, easing: 'ease-in-out'},
type: AnimationMetadataType.Animate
}],
options: null,
selector: 'body',
type: AnimationMetadataType.Query
},
errors, warnings);

expect(errors).toEqual([]);
expect(warnings).toEqual([]);
expect(animationAst).toEqual(<ReturnType<typeof buildAnimationAst>>{
type: 11,
selector: 'body',
limit: 0,
optional: false,
includeSelf: false,
animation: {
type: 4,
timings: {delay: 0, duration: 1000, easing: 'ease-in-out'},
style: {
type: 6,
styles: [new Map([['backgroundColor', '#000']])],
easing: null,
offset: null,
containsDynamicStyles: false,
options: null,
isEmptyStep: false
},
options: null
describe('buildAnimationAst', () => {
it('should build the AST without any errors and warnings', () => {
const driver = new MockAnimationDriver();
const errors: Error[] = [];
const warnings: string[] = [];
const animationAst = buildAnimationAst(
driver, <AnimationMetadata>{
animation: [{
styles: {
offset: null,
styles: {backgroundColor: '#000'},
type: AnimationMetadataType.Style
},
timings: {delay: 0, duration: 1000, easing: 'ease-in-out'},
type: AnimationMetadataType.Animate
}],
options: null,
selector: 'body',
type: AnimationMetadataType.Query
},
originalSelector: 'body',
options: {}
});
errors, warnings);

expect(errors).toEqual([]);
expect(warnings).toEqual([]);
expect(animationAst).toEqual(<ReturnType<typeof buildAnimationAst>>{
type: 11,
selector: 'body',
limit: 0,
optional: false,
includeSelf: false,
animation: {
type: 4,
timings: {delay: 0, duration: 1000, easing: 'ease-in-out'},
style: {
type: 6,
styles: [new Map([['backgroundColor', '#000']])],
easing: null,
offset: null,
containsDynamicStyles: false,
options: null,
isEmptyStep: false
},
options: null
},
originalSelector: 'body',
options: {}
});
});
}
});
Loading

0 comments on commit c078056

Please sign in to comment.