diff --git a/packages/backend-test-utils/src/filesystem/MockDirectory.test.ts b/packages/backend-test-utils/src/filesystem/MockDirectory.test.ts index fd22f09432..82d46d361b 100644 --- a/packages/backend-test-utils/src/filesystem/MockDirectory.test.ts +++ b/packages/backend-test-utils/src/filesystem/MockDirectory.test.ts @@ -271,14 +271,16 @@ describe('createMockDirectory', () => { }); it('should reject non-child paths', () => { - const path = mockDir.resolve('/root/a.txt'); - expect(() => mockDir.setContent({ '/root/a.txt': 'a' })).toThrow( + const pathOutside = createMockDirectory().path; + + const path = mockDir.resolve(pathOutside); + expect(() => mockDir.setContent({ [pathOutside]: 'a' })).toThrow( `Provided path must resolve to a child path of the mock directory, got '${path}'`, ); - expect(() => mockDir.addContent({ '/root/a.txt': 'a' })).toThrow( + expect(() => mockDir.addContent({ [pathOutside]: 'a' })).toThrow( `Provided path must resolve to a child path of the mock directory, got '${path}'`, ); - expect(() => mockDir.content({ path: '/root/a.txt' })).toThrow( + expect(() => mockDir.content({ path: pathOutside })).toThrow( `Provided path must resolve to a child path of the mock directory, got '${path}'`, ); });