|
14 | 14 | const {
|
15 | 15 | throwIfModuleInterfaceNotFound,
|
16 | 16 | throwIfMoreThanOneModuleRegistryCalls,
|
| 17 | + throwIfModuleInterfaceIsMisnamed, |
17 | 18 | throwIfUnusedModuleInterfaceParserError,
|
18 | 19 | throwIfWrongNumberOfCallExpressionArgs,
|
19 | 20 | throwIfIncorrectModuleRegistryCallTypeParameterParserError,
|
20 | 21 | } = require('../error-utils');
|
21 | 22 | const {
|
22 | 23 | ModuleInterfaceNotFoundParserError,
|
23 | 24 | MoreThanOneModuleRegistryCallsParserError,
|
| 25 | + MisnamedModuleInterfaceParserError, |
24 | 26 | UnusedModuleInterfaceParserError,
|
25 | 27 | IncorrectModuleRegistryCallArityParserError,
|
26 | 28 | IncorrectModuleRegistryCallTypeParameterParserError,
|
27 | 29 | } = require('../errors');
|
28 | 30 |
|
| 31 | +describe('throwIfModuleInterfaceIsMisnamed', () => { |
| 32 | + it("don't throw error if module interface name is Spec", () => { |
| 33 | + const nativeModuleName = 'moduleName'; |
| 34 | + const specId = {name: 'Spec'}; |
| 35 | + const parserType = 'Flow'; |
| 36 | + |
| 37 | + expect(() => { |
| 38 | + throwIfModuleInterfaceIsMisnamed(nativeModuleName, specId, parserType); |
| 39 | + }).not.toThrow(MisnamedModuleInterfaceParserError); |
| 40 | + }); |
| 41 | + it('throw error if module interface is misnamed', () => { |
| 42 | + const nativeModuleName = 'moduleName'; |
| 43 | + const specId = {name: 'Name'}; |
| 44 | + const parserType = 'TypeScript'; |
| 45 | + |
| 46 | + expect(() => { |
| 47 | + throwIfModuleInterfaceIsMisnamed(nativeModuleName, specId, parserType); |
| 48 | + }).toThrow(MisnamedModuleInterfaceParserError); |
| 49 | + }); |
| 50 | +}); |
| 51 | + |
29 | 52 | describe('throwIfModuleInterfaceNotFound', () => {
|
30 | 53 | it('throw error if there are zero module specs', () => {
|
31 | 54 | const nativeModuleName = 'moduleName';
|
|
0 commit comments