Skip to content

Commit a9922da

Browse files
bugfix(core) fix incorrent hash generated by token factory
1 parent 66c0b8c commit a9922da

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/core/injector/module-token-factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class ModuleTokenFactory {
2222
public getDynamicMetadataToken(
2323
dynamicModuleMetadata: Partial<DynamicModule> | undefined,
2424
): string {
25-
return dynamicModuleMetadata ? JSON.stringify(dynamicModuleMetadata) : '';
25+
return dynamicModuleMetadata ? hash(dynamicModuleMetadata) : '';
2626
}
2727

2828
public getModuleName(metatype: Type<any>): string {

packages/core/test/injector/module-token-factory.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('ModuleTokenFactory', () => {
4646
expect(token).to.be.deep.eq(
4747
hash({
4848
module: Module.name,
49-
dynamic: JSON.stringify({
49+
dynamic: hash({
5050
components: [{}],
5151
}),
5252
scope: [Module.name],
@@ -62,10 +62,10 @@ describe('ModuleTokenFactory', () => {
6262
});
6363
describe('getDynamicMetadataToken', () => {
6464
describe('when metadata exists', () => {
65-
it('should return stringified metadata', () => {
65+
it('should return hash', () => {
6666
const metadata = { components: ['', {}] };
6767
expect(factory.getDynamicMetadataToken(metadata as any)).to.be.eql(
68-
JSON.stringify(metadata),
68+
hash(metadata),
6969
);
7070
});
7171
});

0 commit comments

Comments
 (0)