Skip to main content

MockDirectory.addContent()

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

Adds content of the mock directory. This will overwrite existing files.

Signature:

addContent(root: MockDirectoryContent): void;

Parameters

Parameter

Type

Description

root

MockDirectoryContent

**Returns:**

void

Example

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