Description:
There is a bug when using the mock method to mock a fixed/primitive value of type array. When attempting to mock a dependency with an array value using the using method, the expected behavior doesn't match the actual outcome. The issue seems to be specific to array values, as other fixed/primitive values of different types are correctly mocked.
Steps to Reproduce:
-
Create a class with a dependency that has an array type.
-
Attempt to mock the array dependency using mock and using methods as shown below:
class SomeClass {
public constructor(@Inject('ARRAY_TYPE') private readonly someArray: string[]) {}
}
const { unit, unitRef } = TestBed.create(SomeClass)
.mock('ARRAY_TYPE')
.using(['1', '2', '3'])
.compile();
-
Observe the result of the mocked array dependency.
Expected Behavior:
The array dependency should be successfully mocked with the provided array value.
Actual Behavior:
The array dependency is not correctly mocked, and the provided array value is not set as the dependency.
Environment:
- Automock Version:
@automock/jest@1.2.3
Additional Information:
I suspect that the issue might be related to how Automock handles array values in the using method. Other fixed/primitive values are correctly set as dependencies, but arrays seem to be affected by this bug.
Description:
There is a bug when using the
mockmethod to mock a fixed/primitive value of type array. When attempting to mock a dependency with an array value using theusingmethod, the expected behavior doesn't match the actual outcome. The issue seems to be specific to array values, as other fixed/primitive values of different types are correctly mocked.Steps to Reproduce:
Create a class with a dependency that has an array type.
Attempt to mock the array dependency using
mockandusingmethods as shown below:Observe the result of the mocked array dependency.
Expected Behavior:
The array dependency should be successfully mocked with the provided array value.
Actual Behavior:
The array dependency is not correctly mocked, and the provided array value is not set as the dependency.
Environment:
@automock/jest@1.2.3Additional Information:
I suspect that the issue might be related to how Automock handles array values in the
usingmethod. Other fixed/primitive values are correctly set as dependencies, but arrays seem to be affected by this bug.