Add jasmine helpers and run their specs
What does this MR do?
Adds jasmine helpers, so we can start to store complex stubs and shared examples.
The new ClassSpecHelper is a helper for testing the structure of a class. It currently just has itShouldBeAStaticMethod
which will assert that the provided base class and method name refers to a static class method.
For example:
describe('SomeClass', () => {
describe('.someMethod', () => {
ClassSpecHelper.itShouldBeAStaticMethod(SomeClass, 'someMethod');
it('should have some other property to assert', () => { ... });
});
});
Also see !6764 (merged) and !8412 (merged) for usage.
It also enables teaspoon to run specs for spec/helpers
. For example, spec/javascripts/helpers/class_spec_helper.js
and have the spec spec/javascripts/helpers/class_spec_helper_spec.js
, which should be tested for coverage.
The .eslintrc
update allows us to have branched dupes, but not block dupes.
For example, we can now do:
describe('SomeClass', () => {
describe('.someMethod', () => {
it('returns true', () => { ... });
});
describe('.someOtherMethod', () => {
it('returns true', () => { ... });
});
});
This wasn't possible before.
You still cant do:
describe('SomeClass', () => {
it('returns true', () => { ... });
it('returns true', () => { ... });
});
Are there points in the code the reviewer needs to double check?
Why was this MR needed?
Screenshots (if relevant)
Does this MR meet the acceptance criteria?
-
Changelog entry added -
Documentation created/updated -
API support added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
Closes #26305 (closed)