@@ -19,29 +19,37 @@ import {UnitTestHelper} from './utility.test';
1919
2020describe ( 'OrchestratorCreateTests' , ( ) => {
2121 const baseModelPath : string = path . resolve ( './resources/model/model_dte_bert_3l' ) ;
22+ const inputPath : string = './test/fixtures/dispatch' ;
23+ const inputPath2 : string = path . resolve ( './test/fixtures/newDispatch' ) ;
24+ const snapshotPath : string = path . join ( inputPath , OrchestratorHelper . SnapshotFileName ) ;
2225
2326 beforeEach ( async ( ) => {
2427 Utility . debuggingLog ( 'OrchestratorCreateTests - downloading a base nerual network language model for unit test' ) ;
2528 await UnitTestHelper . downloadModelFileForTest (
2629 baseModelPath ,
2730 OrchestratorBaseModel . defaultHandler ,
2831 OrchestratorBaseModel . defaultHandler ) ;
32+
33+ if ( Utility . exists ( snapshotPath ) ) {
34+ Utility . deleteFile ( snapshotPath ) ;
35+ }
36+ } ) ;
37+
38+ afterEach ( async ( ) => {
39+ if ( Utility . exists ( inputPath2 ) ) {
40+ Utility . deleteFolderRecursive ( inputPath2 ) ;
41+ }
2942 } ) ;
3043
31- it ( 'Create Dispatch Snapshot' , async function ( ) : Promise < void > {
44+ it ( 'Create Dispatch Snapshot - no existing snapshot ' , async function ( ) : Promise < void > {
3245 Utility . resetFlagToPrintDebuggingLogToConsole ( UnitTestHelper . getDefaultUnitTestDebuggingLogFlag ( ) ) ;
3346 this . timeout ( UnitTestHelper . getDefaultFunctionalTestTimeout ( ) ) ;
34- const outputPath : string = './test/fixtures/dispatch' ;
3547
36- const snapshotPath : string = path . join ( outputPath , OrchestratorHelper . SnapshotFileName ) ;
37- if ( Utility . exists ( snapshotPath ) ) {
38- Utility . deleteFile ( snapshotPath ) ;
39- }
4048 await OrchestratorCreate . runAsync (
4149 baseModelPath ,
4250 '' ,
43- outputPath ,
44- outputPath ,
51+ inputPath ,
52+ inputPath ,
4553 true ) ;
4654
4755 assert . ok ( Utility . exists ( snapshotPath ) ) ;
@@ -50,6 +58,41 @@ describe('OrchestratorCreateTests', () => {
5058 assert . ok ( snapshotContent . indexOf ( 'Weather' ) > 0 ) ;
5159 } ) ;
5260
61+ it ( 'Create Dispatch Snapshot - incremental' , async function ( ) : Promise < void > {
62+ Utility . resetFlagToPrintDebuggingLogToConsole ( UnitTestHelper . getDefaultUnitTestDebuggingLogFlag ( ) ) ;
63+ this . timeout ( UnitTestHelper . getDefaultFunctionalTestTimeout ( ) ) ;
64+
65+ await OrchestratorCreate . runAsync (
66+ baseModelPath ,
67+ '' ,
68+ inputPath ,
69+ inputPath ,
70+ true ) ;
71+
72+ assert . ok ( Utility . exists ( snapshotPath ) ) ;
73+ const snapshotContent : string = OrchestratorHelper . readFile ( snapshotPath ) ;
74+ assert . ok ( snapshotContent . indexOf ( 'HomeAutomation' ) > 0 ) ;
75+ assert . ok ( snapshotContent . indexOf ( 'Weather' ) > 0 ) ;
76+
77+ fs . ensureDirSync ( inputPath2 ) ;
78+ fs . copySync ( path . resolve ( inputPath ) , inputPath2 ) ;
79+ fs . copySync ( path . resolve ( './test/fixtures/Gaming.lu' ) , path . join ( inputPath2 , 'Gaming.lu' ) ) ;
80+
81+ await OrchestratorCreate . runAsync (
82+ baseModelPath ,
83+ '' ,
84+ inputPath2 ,
85+ inputPath ,
86+ true ) ;
87+
88+ assert . ok ( Utility . exists ( snapshotPath ) ) ;
89+ const snapshotContent2 : string = OrchestratorHelper . readFile ( snapshotPath ) ;
90+ assert . ok ( snapshotContent2 . length > snapshotContent . length ) ;
91+ assert . ok ( snapshotContent2 . indexOf ( 'HomeAutomation' ) > 0 ) ;
92+ assert . ok ( snapshotContent2 . indexOf ( 'Weather' ) > 0 ) ;
93+ assert . ok ( snapshotContent2 . indexOf ( 'Gaming' ) > 0 ) ;
94+ } ) ;
95+
5396 it ( 'Create Snapshot - LU file with reference to other LU file' , async function ( ) : Promise < void > {
5497 Utility . resetFlagToPrintDebuggingLogToConsole ( UnitTestHelper . getDefaultUnitTestDebuggingLogFlag ( ) ) ;
5598 this . timeout ( UnitTestHelper . getDefaultFunctionalTestTimeout ( ) ) ;
0 commit comments