Skip to main content

MockDirectory.setContent()

Home > @backstage/backend-test-utils > MockDirectory > setContent

Sets the content of the mock directory. This will remove any existing content.

Signature:

setContent(root: MockDirectoryContent): void;

Parameters

Parameter

Type

Description

root

MockDirectoryContent

**Returns:**

void

Example

mockDir.setContent({
'test.txt': 'content',
'sub-dir': {
'file.txt': 'content',
'nested-dir/file.txt': 'content',
},
'empty-dir': {},
'binary-file': Buffer.from([0, 1, 2]),
});