-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#354): better error instead of is not in JIT mode
- Loading branch information
Showing
10 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default (value: any, funcName: string) => { | ||
if (value === undefined || value === null) { | ||
throw new Error(`An empty parameter has been passed into ${funcName}. Please check that its import is correct.`); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { | ||
MockComponent, | ||
MockDirective, | ||
MockInstance, | ||
MockModule, | ||
MockPipe, | ||
MockProvider, | ||
MockRender, | ||
} from 'ng-mocks'; | ||
|
||
describe('issue-354', () => { | ||
it('does not accept an empty module', () => { | ||
expect(() => MockModule(undefined as any)).toThrowError( | ||
'An empty parameter has been passed into MockModule. Please check that its import is correct.', | ||
); | ||
expect(() => MockModule(null as any)).toThrowError( | ||
'An empty parameter has been passed into MockModule. Please check that its import is correct.', | ||
); | ||
}); | ||
|
||
it('does not accept an empty component', () => { | ||
expect(() => MockComponent(undefined as any)).toThrowError( | ||
'An empty parameter has been passed into MockComponent. Please check that its import is correct.', | ||
); | ||
expect(() => MockComponent(null as any)).toThrowError( | ||
'An empty parameter has been passed into MockComponent. Please check that its import is correct.', | ||
); | ||
}); | ||
|
||
it('does not accept an empty directive', () => { | ||
expect(() => MockDirective(undefined as any)).toThrowError( | ||
'An empty parameter has been passed into MockDirective. Please check that its import is correct.', | ||
); | ||
expect(() => MockDirective(null as any)).toThrowError( | ||
'An empty parameter has been passed into MockDirective. Please check that its import is correct.', | ||
); | ||
}); | ||
|
||
it('does not accept an empty pipe', () => { | ||
expect(() => MockPipe(undefined as any)).toThrowError( | ||
'An empty parameter has been passed into MockPipe. Please check that its import is correct.', | ||
); | ||
expect(() => MockPipe(null as any)).toThrowError( | ||
'An empty parameter has been passed into MockPipe. Please check that its import is correct.', | ||
); | ||
}); | ||
|
||
it('does not accept an empty provider', () => { | ||
expect(() => MockProvider(undefined as any)).toThrowError( | ||
'An empty parameter has been passed into MockProvider. Please check that its import is correct.', | ||
); | ||
expect(() => MockProvider(null as any)).toThrowError( | ||
'An empty parameter has been passed into MockProvider. Please check that its import is correct.', | ||
); | ||
}); | ||
|
||
it('does not accept an empty render', () => { | ||
expect(() => MockRender(undefined as any)).toThrowError( | ||
'An empty parameter has been passed into MockRender. Please check that its import is correct.', | ||
); | ||
expect(() => MockRender(null as any)).toThrowError( | ||
'An empty parameter has been passed into MockRender. Please check that its import is correct.', | ||
); | ||
}); | ||
|
||
it('does not accept an empty instance', () => { | ||
expect(() => MockInstance(undefined as any)).toThrowError( | ||
'An empty parameter has been passed into MockInstance. Please check that its import is correct.', | ||
); | ||
expect(() => MockInstance(null as any)).toThrowError( | ||
'An empty parameter has been passed into MockInstance. Please check that its import is correct.', | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters