Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit ac0b18e

Browse files
oodamienghillert
authored andcommitted
Stream creation: update stream validation
Resolves #910 - An empty stream is not allow - Update test
1 parent 9e79970 commit ac0b18e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

ui/src/app/streams/stream-create/stream-create.component.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,23 @@ describe('StreamCreateComponent', () => {
140140
}, 1000);
141141
});
142142

143+
it('disable stream creation for invalid stream (space)', (done) => {
144+
fixture.detectChanges();
145+
expect(component.isCreateStreamsDisabled).toBeTruthy();
146+
component.dsl = ' ';
147+
fixture.detectChanges();
148+
// Validation is performed after a delay, hence the wait
149+
setTimeout(() => {
150+
expect(component.dsl).toEqual(' ');
151+
expect(component.parseErrors.length).toEqual(0);
152+
const allMarkers = [];
153+
Array.from(component.validationMarkers.values()).forEach(markers => allMarkers.push(...markers));
154+
expect(allMarkers.length).toEqual(0);
155+
expect(component.isCreateStreamsDisabled).toBeTruthy();
156+
done();
157+
}, 1000);
158+
});
159+
143160
it('disable stream creation for graph validation error marker', (done) => {
144161
fixture.detectChanges();
145162
expect(component.isCreateStreamsDisabled).toBeTruthy();

ui/src/app/streams/stream-create/stream-create.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export class StreamCreateComponent implements OnInit, OnDestroy {
246246
}
247247

248248
get isCreateStreamsDisabled(): boolean {
249-
if (this.dsl && this.contentValidated && this.parseErrors.length === 0) {
249+
if (this.dsl && this.dsl.trim() && this.contentValidated && this.parseErrors.length === 0) {
250250
return Array.from(this.validationMarkers.values())
251251
.find(markers => markers
252252
.find(m => m.severity === Flo.Severity.Error) !== undefined) !== undefined;

0 commit comments

Comments
 (0)