-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: removal dependency on decorators
- Loading branch information
Showing
13 changed files
with
100 additions
and
138 deletions.
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,20 @@ | ||
import { extendClass } from './core.helpers'; | ||
import decorateMock from './decorate.mock'; | ||
|
||
describe('DebuggableMock', () => { | ||
it('prefixes the class name with MockOf', () => { | ||
class Foo {} | ||
const mock = extendClass(Foo); | ||
decorateMock(mock, Foo); | ||
|
||
expect(mock.name).toBe('MockOfFoo'); | ||
}); | ||
|
||
it('adds a mockOf property that is the class being replaced with a mock copy', () => { | ||
class Bar {} | ||
const mock = extendClass(Bar); | ||
decorateMock(mock, Bar); | ||
|
||
expect((mock as any).mockOf).toBe(Bar); | ||
}); | ||
}); |
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,11 @@ | ||
import { AnyType } from './core.types'; | ||
import { ngMocksMockConfig } from './mock'; | ||
|
||
export default function (base: AnyType<any>, mockClass: AnyType<any>, config: ngMocksMockConfig = {}): void { | ||
Object.defineProperties(base, { | ||
mockOf: { value: mockClass }, | ||
name: { value: `MockOf${mockClass.name}` }, | ||
nameConstructor: { value: base.name }, | ||
}); | ||
base.prototype.__ngMocksConfig = config; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.