mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
26 lines
1.1 KiB
JavaScript
26 lines
1.1 KiB
JavaScript
import { mergeWithComponents } from '../lib/modules/components';
|
|
import { Components } from 'meteor/vulcan:core';
|
|
import expect from 'expect';
|
|
import { initComponentTest } from 'meteor/vulcan:test';
|
|
|
|
initComponentTest();
|
|
|
|
describe('vulcan:lib/components', function () {
|
|
describe('mergeWithComponents', function () {
|
|
const TestComponent = () => 'foo';
|
|
const OverrideTestComponent = () => 'bar';
|
|
Components.TestComponent = TestComponent;
|
|
it('override existing components', function () {
|
|
const MyComponents = { TestComponent: OverrideTestComponent };
|
|
const MergedComponents = mergeWithComponents(MyComponents);
|
|
expect(MergedComponents.TestComponent).toEqual(OverrideTestComponent);
|
|
// eslint-disable-next-line
|
|
expect(MergedComponents.TestComponent()).toEqual('bar');
|
|
});
|
|
it('return \'Components\' if no components are provided', function () {
|
|
expect(mergeWithComponents()).toEqual(Components);
|
|
expect(mergeWithComponents().TestComponent).toEqual(TestComponent);
|
|
});
|
|
|
|
});
|
|
});
|