-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test cases; (refactor: move SinonCPTool to test/construct/tool/ and rename it to SinonTool)
- Loading branch information
Showing
39 changed files
with
715 additions
and
492 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
let loadImages = imageDataList => { | ||
LoadImageDoService.loadImages(imageDataList); | ||
}; |
3 changes: 3 additions & 0 deletions
3
src/construct/application_layer/dependency/NetworkDpApService.re
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,3 @@ | ||
let set = dp => { | ||
DpContainer.setNetworkDp(dp); | ||
}; |
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
6 changes: 6 additions & 0 deletions
6
src/construct/domain_layer/dependency/interface/INetworkDp.re
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,6 @@ | ||
type path = string; | ||
|
||
type network = { | ||
readImageFile: | ||
path => Result.t2(WonderBsMost.Most.stream(ImagePOType.data)), | ||
}; |
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
7 changes: 7 additions & 0 deletions
7
src/construct/domain_layer/dependency/interface/po/ImagePOType.re
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,7 @@ | ||
type id = string; | ||
|
||
type data = { | ||
width: int, | ||
height: int, | ||
data: Js.Typed_array.Uint8Array.t, | ||
}; |
20 changes: 20 additions & 0 deletions
20
src/construct/domain_layer/domain/asset/image/service/LoadImageDoService.re
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,20 @@ | ||
open WonderBsMost.Most; | ||
|
||
let loadImages = imageDataList => { | ||
imageDataList | ||
->ListSt.traverseResultM(((id, path)) => { | ||
DpContainer.unsafeGetNetworkDp().readImageFile(path) | ||
->Result.mapSuccess(stream => { | ||
stream->tap( | ||
imageData => { | ||
DpContainer.unsafeGetImageRepoDp().setData( | ||
id, | ||
imageData, | ||
) | ||
}, | ||
_, | ||
) | ||
}) | ||
}) | ||
->Result.mapSuccess(streamList => {streamList->ListSt.toArray->mergeArray}); | ||
}; |
3 changes: 3 additions & 0 deletions
3
src/construct/external_layer/api/run/dependency/NetworkDpRunAPI.re
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,3 @@ | ||
let set = (dp: INetworkDp.network) => { | ||
NetworkDpApService.set(dp); | ||
}; |
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,3 @@ | ||
let loadImages = imageDataList => { | ||
AssetApService.loadImages(imageDataList); | ||
}; |
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,3 @@ | ||
let loadImages = imageDataArr => { | ||
AssetRunAPI.loadImages(imageDataArr->ListSt.fromArray); | ||
}; |
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
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,3 @@ | ||
let loadImages = imageDataArr => { | ||
AssetCPApService.loadImages(imageDataArr); | ||
}; |
3 changes: 3 additions & 0 deletions
3
src/run/cloud_picture/external_layer/api/dependency/NetworkDpCPAPI.re
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,3 @@ | ||
let set = dp => { | ||
NetworkDpRunAPI.set(dp); | ||
}; |
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
3 changes: 3 additions & 0 deletions
3
src/run/cloud_picture/infrastructure_layer/data/po/asset/ImageCPPOType.re
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,3 @@ | ||
type image = { | ||
dataMap: ImmutableHashMap.t(ImagePOType.id, ImagePOType.data), | ||
}; |
14 changes: 14 additions & 0 deletions
14
src/run/cloud_picture/infrastructure_layer/dependency/repo/asset/ImageCPRepoDp.re
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,14 @@ | ||
open ImageCPPOType; | ||
|
||
let setData = (id, data) => { | ||
let {dataMap} as po = CPRepo.getImage(); | ||
|
||
CPRepo.setImage({ | ||
...CPRepo.getImage(), | ||
dataMap: dataMap->ImmutableHashMap.set(id, data), | ||
}); | ||
}; | ||
|
||
let getData = id => { | ||
CPRepo.getImage().dataMap->ImmutableHashMap.getNullable(id); | ||
}; |
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 |
---|---|---|
@@ -1,5 +1,16 @@ | ||
open Sinon; | ||
|
||
let injectAllDependencies = (~isDebug=true, ()) => { | ||
DirectorCPApService._injectDependencies(); | ||
|
||
OtherConfigDpCPAPI.set({getIsDebug: () => isDebug}); | ||
}; | ||
}; | ||
|
||
let injectNetworkDp = | ||
( | ||
~sandbox, | ||
~readImageFile=createEmptyStub(refJsObjToSandbox(sandbox^)), | ||
(), | ||
) => { | ||
NetworkDpRunAPI.set({readImageFile: readImageFile}); | ||
}; |
File renamed without changes.
Oops, something went wrong.