Skip to content

Commit 958b82b

Browse files
authored
test(form): add export contract tests (#96)
Also adjusts the main export barrel file to explicitly export library members
1 parent 5b46dc7 commit 958b82b

File tree

2 files changed

+118
-13
lines changed

2 files changed

+118
-13
lines changed

packages/form/src/exports.spec.ts

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import {
2+
composeReducers,
3+
ConnectArrayDirective,
4+
ConnectArrayTemplate,
5+
ConnectBase,
6+
ConnectDirective,
7+
defaultFormReducer,
8+
FORM_CHANGED,
9+
FormException,
10+
FormStore,
11+
formStoreFactory,
12+
NgReduxFormConnectArrayModule,
13+
NgReduxFormConnectModule,
14+
NgReduxFormModule,
15+
provideReduxForms,
16+
ReactiveConnectDirective,
17+
} from './index';
18+
19+
describe('The @angular-redux/form package exports', () => {
20+
it('should contain the composeReducers function', () => {
21+
expect(composeReducers).toBeDefined();
22+
});
23+
24+
it('should contain the ConnectArrayDirective class', () => {
25+
expect(ConnectArrayDirective).toBeDefined();
26+
});
27+
28+
it('should contain the ConnectArrayTemplate class', () => {
29+
expect(ConnectArrayTemplate).toBeDefined();
30+
});
31+
32+
it('should contain the ConnectBase class', () => {
33+
expect(ConnectBase).toBeDefined();
34+
});
35+
36+
it('should contain the ConnectDirective class', () => {
37+
expect(ConnectDirective).toBeDefined();
38+
});
39+
40+
it('should contain the defaultFormReducer function', () => {
41+
expect(defaultFormReducer).toBeDefined();
42+
});
43+
44+
it('should contain the FORM_CHANGED const', () => {
45+
expect(FORM_CHANGED).toBeDefined();
46+
});
47+
48+
it('should contain the FormException class', () => {
49+
expect(FormException).toBeDefined();
50+
});
51+
52+
it('should contain the FormStore class', () => {
53+
expect(FormStore).toBeDefined();
54+
});
55+
56+
it('should contain the formStoreFactory function', () => {
57+
expect(formStoreFactory).toBeDefined();
58+
});
59+
60+
it('should contain the NgReduxFormConnectArrayModule class', () => {
61+
expect(NgReduxFormConnectArrayModule).toBeDefined();
62+
});
63+
64+
it('should contain the NgReduxFormConnectModule class', () => {
65+
expect(NgReduxFormConnectModule).toBeDefined();
66+
});
67+
68+
it('should contain the NgReduxFormModule class', () => {
69+
expect(NgReduxFormModule).toBeDefined();
70+
});
71+
72+
it('should contain the provideReduxForms function', () => {
73+
expect(provideReduxForms).toBeDefined();
74+
});
75+
76+
it('should contain the ReactiveConnectDirective class', () => {
77+
expect(ReactiveConnectDirective).toBeDefined();
78+
});
79+
});

packages/form/src/index.ts

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,39 @@
1-
export * from './compose-reducers';
2-
export * from './form-reducer';
3-
export * from './form-exception';
4-
export * from './form-store';
5-
export * from './configure';
6-
export * from './connect/connect-base';
7-
export * from './connect/connect-reactive';
8-
export * from './connect/connect.directive';
9-
export * from './connect/connect.module';
10-
export * from './connect-array/connect-array-template';
11-
export * from './connect-array/connect-array.directive';
12-
export * from './connect-array/connect-array.module';
13-
export * from './module';
1+
import { composeReducers } from './compose-reducers';
2+
import { provideReduxForms } from './configure';
3+
import { FormException } from './form-exception';
4+
import { defaultFormReducer } from './form-reducer';
5+
import { AbstractStore, FORM_CHANGED, FormStore } from './form-store';
6+
import { formStoreFactory, NgReduxFormModule } from './module';
7+
8+
import { ConnectBase, ControlPair } from './connect/connect-base';
9+
import { ReactiveConnectDirective } from './connect/connect-reactive';
10+
import { ConnectDirective } from './connect/connect.directive';
11+
import { NgReduxFormConnectModule } from './connect/connect.module';
12+
13+
import { ConnectArrayTemplate } from './connect-array/connect-array-template';
14+
import { ConnectArrayDirective } from './connect-array/connect-array.directive';
15+
import { NgReduxFormConnectArrayModule } from './connect-array/connect-array.module';
16+
17+
// Warning: don't do this:
18+
// export * from './foo'
19+
// ... because it breaks rollup. See
20+
// https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
21+
export {
22+
AbstractStore,
23+
composeReducers,
24+
ConnectArrayDirective,
25+
ConnectArrayTemplate,
26+
ConnectBase,
27+
ConnectDirective,
28+
ControlPair,
29+
defaultFormReducer,
30+
FORM_CHANGED,
31+
FormException,
32+
FormStore,
33+
formStoreFactory,
34+
NgReduxFormConnectArrayModule,
35+
NgReduxFormConnectModule,
36+
NgReduxFormModule,
37+
provideReduxForms,
38+
ReactiveConnectDirective,
39+
};

0 commit comments

Comments
 (0)