Skip to content

Commit d19d58b

Browse files
committed
add path validation unit test for processProtectedData
1 parent 693ba6b commit d19d58b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

packages/sdk/tests/unit/dataProtectorCore/processProtectedData/processProtectedData.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,28 @@ describe('processProtectedData', () => {
152152
);
153153
});
154154
});
155+
156+
describe('When given path is NOT a valid string', () => {
157+
it('should throw a yup ValidationError with the correct message', async () => {
158+
// --- GIVEN
159+
const invalidPath = 42;
160+
161+
await expect(
162+
// --- WHEN
163+
processProtectedData({
164+
// @ts-expect-error No need for iexec here
165+
iexec: {},
166+
protectedData: getRandomAddress(),
167+
app: getRandomAddress(),
168+
// @ts-expect-error Type 'number' is not assignable to type 'string'
169+
path: invalidPath,
170+
})
171+
// --- THEN
172+
).rejects.toThrow(
173+
new ValidationError('path should be a string')
174+
);
175+
});
176+
});
155177

156178
describe('When maxPrice is not a positive number', () => {
157179
it('should throw a yup ValidationError with the correct message', async () => {

0 commit comments

Comments
 (0)