-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: broadcast * test: footer nav * fix: ci * fix: fmt
- Loading branch information
Showing
31 changed files
with
180 additions
and
145 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
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
public interface IGeoHubClient { | ||
Task MessageReceived(string userId, string message); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -35,5 +35,4 @@ private GeolocationPosition MockPosition(int index) { | |
} | ||
}; | ||
} | ||
} | ||
|
||
} |
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
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
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 |
---|---|---|
|
@@ -21,4 +21,4 @@ public async Task Delete(string vendorId) { | |
db.Vendors.Remove(vendor); | ||
await db.SaveChangesAsync(); | ||
} | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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
8 changes: 7 additions & 1 deletion
8
...eonwheels.client/src/app/libs/broadcast/components/vendor-form/vendor-form.component.html
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
63 changes: 59 additions & 4 deletions
63
...wheels.client/src/app/libs/broadcast/components/vendor-form/vendor-form.component.spec.ts
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,22 +1,77 @@ | ||
import { ComponentFixture, TestBed } from "@angular/core/testing"; | ||
|
||
import { | ||
ComponentFixture, | ||
TestBed, | ||
ComponentFixtureAutoDetect, | ||
} from "@angular/core/testing"; | ||
import { VendorFormComponent } from "./vendor-form.component"; | ||
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; | ||
import { VendorForm } from "~/app/libs/shared/models"; | ||
import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; | ||
|
||
describe("VendorFormComponent", () => { | ||
let component: VendorFormComponent; | ||
let fixture: ComponentFixture<VendorFormComponent>; | ||
|
||
beforeEach(async () => { | ||
const formBuilder = new FormBuilder(); | ||
const vendorForm: FormGroup<VendorForm> = formBuilder.nonNullable.group({ | ||
id: ["", Validators.required], | ||
displayName: ["", Validators.required], | ||
description: ["", Validators.required], | ||
}); | ||
|
||
await TestBed.configureTestingModule({ | ||
imports: [VendorFormComponent], | ||
imports: [VendorFormComponent, BrowserAnimationsModule], | ||
providers: [{ provide: ComponentFixtureAutoDetect, useValue: true }], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(VendorFormComponent); | ||
fixture.componentRef.setInput("vendorForm", vendorForm); | ||
fixture.autoDetectChanges(); | ||
|
||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it("should create", () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it("labels should exists", () => { | ||
fixture.detectChanges(); | ||
const root: HTMLElement = fixture.nativeElement; | ||
expect(root).toBeTruthy(); | ||
|
||
const labels: HTMLLabelElement[] = Array.from( | ||
root.querySelectorAll("label") | ||
); | ||
expect(labels.length).toBe(2); | ||
expect(labels[0].innerText).toBe("Name"); | ||
expect(labels[1].innerText).toBe("Description"); | ||
}); | ||
|
||
it("validation should work", async () => { | ||
const root: HTMLElement = fixture.nativeElement; | ||
expect(root).toBeTruthy(); | ||
expect(component.vendorForm).toBeTruthy(); | ||
|
||
component.vendorForm?.markAllAsTouched(); | ||
fixture.detectChanges(); | ||
expect(root.innerText).toContain("Name is required"); | ||
expect(root.innerText).toContain("Description is required"); | ||
|
||
const nameInput: HTMLInputElement | null = root.querySelector("input"); | ||
expect(nameInput).not.toBeNull(); | ||
|
||
if (nameInput == null) { | ||
return; | ||
} | ||
|
||
nameInput.value = "ABC"; | ||
// Dispatch a DOM event so that Angular learns of input value change. | ||
nameInput.dispatchEvent(new Event("input")); | ||
// Wait for Angular to update the display binding | ||
await fixture.whenStable(); | ||
|
||
expect(root.innerText).not.toContain("Name is required"); | ||
}); | ||
}); |
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
Oops, something went wrong.