You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assert(net._prepTraining.calledOnce,`_prepTraining was expected to be called once but was called ${net._prepTraining.callCount}`);
95
96
net
96
97
.trainAsync(trainingData,opts)
97
98
.then(()=>{
98
99
assert(net._prepTraining.calledTwice,`_prepTraining was expected to be called twice but was called ${net._prepTraining.callCount}`);
99
-
killSpy(net,'_prepTraining');
100
100
done();
101
101
})
102
102
.catch(e=>{
103
103
assert.ok(false,e.toString());
104
-
killSpy(net,'_prepTraining');
105
104
done()
106
105
});
107
106
});
108
107
109
108
it('_updateTrainingOptions()',(done)=>{
110
-
getSpy(net,'_updateTrainingOptions');
111
109
net.train(trainingData,opts);
112
110
assert(net._updateTrainingOptions.calledOnce,`_updateTrainingOptions was expected to be called once but was called ${net._updateTrainingOptions.callCount}`);
113
111
net
114
112
.trainAsync(trainingData,opts)
115
113
.then(()=>{
116
114
assert(net._updateTrainingOptions.calledTwice,`_updateTrainingOptions was expected to be called twice but was called ${net._prepTraining.callCount}`);
117
-
killSpy(net,'_updateTrainingOptions');
118
115
done();
119
116
})
120
117
.catch(e=>{
121
118
assert.ok(false,e.toString());
122
-
killSpy(net,'_updateTrainingOptions');
123
119
done()
124
120
});
125
121
});
126
122
127
123
it('_formatData()',(done)=>{
128
-
getSpy(net,'_formatData');
129
124
net.train(trainingData,opts);
130
125
assert(net._formatData.calledOnce,`_formatData was expected to be called once but was called ${net._formatData.callCount}`);
131
126
net
132
127
.trainAsync(trainingData,opts)
133
128
.then(()=>{
134
129
assert(net._formatData.calledTwice,`_formatData was expected to be called twice but was called ${net._prepTraining.callCount}`);
135
-
killSpy(net,'_formatData');
136
130
done();
137
131
})
138
132
.catch(e=>{
139
133
assert.ok(false,e.toString());
140
-
killSpy(net,'_formatData');
141
134
done()
142
135
});
143
136
});
144
137
145
138
it('_verifyIsInitialized()',(done)=>{
146
-
getSpy(net,'_verifyIsInitialized');
147
139
net.train(trainingData,opts);
148
140
assert(net._verifyIsInitialized.calledOnce,`_verifyIsInitialized was expected to be called once but was called ${net._verifyIsInitialized.callCount}`);
149
141
net
150
142
.trainAsync(trainingData,opts)
151
143
.then(()=>{
152
144
assert(net._verifyIsInitialized.calledTwice,`_verifyIsInitialized was expected to be called twice but was called ${net._prepTraining.callCount}`);
153
-
killSpy(net,'_verifyIsInitialized');
154
145
done();
155
146
})
156
147
.catch(e=>{
157
148
assert.ok(false,e.toString());
158
-
killSpy(net,'_verifyIsInitialized');
159
149
done()
160
150
});
161
151
});
162
152
163
153
it('_trainingTick()',(done)=>{
164
-
getSpy(net,'_trainingTick');
165
154
net.train(trainingData,opts);
166
155
// The loop calls _trainingTick twice and returns imidiatly on second call
167
156
assert(net._trainingTick.calledTwice,`_trainingTick was expected to be called twice but was called ${net._prepTraining.callCount}`);
@@ -170,12 +159,10 @@ describe('train() and trainAsync() use the same private methods', () => {
170
159
.then(()=>{
171
160
// trainAsync only calls _trainingTick once
172
161
assert(net._trainingTick.calledThrice,`_trainingTick was expected to be called thrice but was called ${net._prepTraining.callCount}`);
0 commit comments