-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonas Verhoelen
committed
Jan 14, 2020
1 parent
d331574
commit fbfa960
Showing
10 changed files
with
270 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Tree } from '../src/renderer/components/tree/TreeComponent' | ||
import SecretsDirectoryService from '../src/renderer/explorer-app/side-navigation/SecretsDirectoryService' | ||
|
||
describe('SecretsDirectoryService', () => { | ||
it('should transform a list of secret names into tree structure', () => { | ||
const secretPaths = [ | ||
'codecentric/common/github/password', | ||
'codecentric/common/github/username', | ||
'codecentric/common/gitlab/password', | ||
'codecentric/common/gitlab/username', | ||
'codecentric/customers/some/notes' | ||
] | ||
const tree: Tree = SecretsDirectoryService.secretPathsToTree(secretPaths, { name: 'someName', path: '' }, false) | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
|
||
it('should automatically toggle all nodes', () => { | ||
const secretPaths = [ | ||
'codecentric/some-secret', | ||
'codecentric/common/something', | ||
'codecentric/common/another-thing', | ||
'codecentric/db/user', | ||
'codecentric/db/password' | ||
] | ||
const tree: Tree = SecretsDirectoryService.secretPathsToTree(secretPaths, { name: 'someName', path: '' }, true) | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
|
||
it('should preserve previously toggled nodes when building a new tree', () => { | ||
const secretPaths = [ | ||
'codecentric/some-secret', | ||
'codecentric/common/something', | ||
'codecentric/common/another-thing', | ||
'codecentric/db/user', | ||
'codecentric/db/password' | ||
] | ||
const tree: Tree = SecretsDirectoryService.secretPathsToTree( | ||
secretPaths, | ||
{ | ||
name: '', | ||
path: '', | ||
children: [ | ||
{ | ||
name: 'codecentric', | ||
path: 'codecentric', | ||
toggled: true, | ||
children: [{ name: 'some-secret', path: 'codecentric/some-secret' }, { name: 'common', path: 'codecentric/common', toggled: true }] | ||
} | ||
] | ||
}, | ||
false | ||
) | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
}) |
File renamed without changes.
Oops, something went wrong.