Skip to content

Commit 191edda

Browse files
alan-agius4hansl
authored andcommitted
test: add unit test to cover subdirs
Closes #12143
1 parent b561657 commit 191edda

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/angular_devkit/schematics/src/tree/host-tree_spec.ts

+11
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,15 @@ describe('FilterHostTree', () => {
115115
expect(filteredFiles).toEqual(['/dir1/file1'].map(normalize));
116116
expect(filtered2.actions.map(a => a.kind)).toEqual([]);
117117
});
118+
119+
it('subdirs only contains directories', () => {
120+
const fs = new virtualFs.test.TestHost({
121+
'/dir1/file1': '',
122+
'/dir1/dir2/file2': '',
123+
'/dir1/dir3/file3': '',
124+
});
125+
const tree = new HostTree(fs);
126+
const subDirs = tree.getDir('/dir1').subdirs;
127+
expect(subDirs as string[]).toEqual(['dir2', 'dir3']);
128+
});
118129
});

0 commit comments

Comments
 (0)