File tree Expand file tree Collapse file tree 3 files changed +39
-4
lines changed
packages/import-utils/src Expand file tree Collapse file tree 3 files changed +39
-4
lines changed Original file line number Diff line number Diff line change @@ -7,15 +7,15 @@ export function getDirectoryPaths(directories: ISandboxDirectory[]) {
77 prevPath : string ,
88 directoryShortid : string | undefined
99 ) => {
10- const dir = directories . find (
11- ( d ) => d . directoryShortid === directoryShortid && d . title === d . title
10+ const dirs = directories . filter (
11+ ( d ) => d . directoryShortid === directoryShortid
1212 ) ;
1313
14- if ( dir ) {
14+ dirs . forEach ( ( dir ) => {
1515 const dirPath = prevPath + "/" + dir . title ;
1616 paths [ dirPath ] = dir ;
1717 addDirectory ( dirPath , dir . shortid ) ;
18- }
18+ } )
1919 } ;
2020
2121 directories
Original file line number Diff line number Diff line change @@ -118,6 +118,24 @@ Object {
118118 " title" : " index.js" ,
119119 " uploadId" : undefined ,
120120 },
121+ Object {
122+ " code" : " hello4" ,
123+ " directoryShortid" : " dir4" ,
124+ " isBinary" : false ,
125+ " sha" : undefined ,
126+ " shortid" : " 3" ,
127+ " title" : " template.md" ,
128+ " uploadId" : undefined ,
129+ },
130+ Object {
131+ " code" : " hello5" ,
132+ " directoryShortid" : " dir5" ,
133+ " isBinary" : false ,
134+ " sha" : undefined ,
135+ " shortid" : " 4" ,
136+ " title" : " config.yml" ,
137+ " uploadId" : undefined ,
138+ },
121139 ],
122140}
123141` ;
Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ describe("denormalize", () => {
4747 "index.js" : { content : "hello" , isBinary : false } ,
4848 "world/index.js" : { content : "hello2" , isBinary : false } ,
4949 "world/hello/index.js" : { content : "hello3" , isBinary : false } ,
50+ ".github/ISSUE_TEMPLATES/template.md" : { content : "hello4" , isBinary : false } ,
51+ ".github/workflows/config.yml" : { content : "hello5" , isBinary : false } ,
5052 } ;
5153
5254 const existingDirs = [
@@ -60,6 +62,21 @@ describe("denormalize", () => {
6062 title : "hello" ,
6163 shortid : "dir2" ,
6264 } ,
65+ {
66+ directoryShortid : undefined ,
67+ title : ".github" ,
68+ shortid : "dir3" ,
69+ } ,
70+ {
71+ directoryShortid : "dir3" ,
72+ title : "ISSUE_TEMPLATES" ,
73+ shortid : "dir4" ,
74+ } ,
75+ {
76+ directoryShortid : "dir3" ,
77+ title : "workflows" ,
78+ shortid : "dir5" ,
79+ } ,
6380 ] ;
6481
6582 const denormalized = denormalize ( paths , existingDirs ) ;
You can’t perform that action at this time.
0 commit comments