-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: DaviMarinho <[email protected]>
- Loading branch information
1 parent
2b73995
commit 8c1095b
Showing
8 changed files
with
87 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: CI/CD Pipeline Frontend | ||
|
||
on: push | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Test | ||
run: ng test | ||
|
||
deploy: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Deploy to Heroku | ||
uses: akhileshns/[email protected] | ||
with: | ||
heroku_api_key: ${{ secrets.HEROKU_API_KEY }} | ||
heroku_app_name: your-heroku-app-name | ||
heroku_email: [email protected] | ||
heroku_deploy_branch: main |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "un-b-tv-frontend", | ||
"name": "unb-tv-frontend", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"ng": "ng", | ||
|
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,16 +1,17 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { LoginComponent } from './login.component'; | ||
import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; | ||
|
||
describe('LoginComponent', () => { | ||
let component: LoginComponent; | ||
let fixture: ComponentFixture<LoginComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ LoginComponent ] | ||
}) | ||
.compileComponents(); | ||
TestBed.configureTestingModule({ | ||
declarations: [LoginComponent], | ||
imports: [ReactiveFormsModule], | ||
providers: [FormBuilder], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(LoginComponent); | ||
component = fixture.componentInstance; | ||
|
@@ -20,4 +21,40 @@ describe('LoginComponent', () => { | |
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should have a valid form on initialization', () => { | ||
expect(component.userForm.valid).toBeFalse(); | ||
}); | ||
|
||
it('should call login method when the form is submitted', () => { | ||
spyOn(component, 'login'); | ||
const form = component.userForm; | ||
form.setValue({ email: '[email protected]', password: 'password' }); | ||
fixture.detectChanges(); | ||
|
||
const submitButton = fixture.nativeElement.querySelector( | ||
'button[type="submit"]' | ||
); | ||
submitButton.click(); | ||
|
||
expect(component.login).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should call navigator method when "Esqueceu a senha?" is clicked', () => { | ||
spyOn(component, 'navigator'); | ||
const forgotPasswordLink = | ||
fixture.nativeElement.querySelector('.text-gray-400'); | ||
forgotPasswordLink.click(); | ||
|
||
expect(component.navigator).toHaveBeenCalledWith('/sendCodeResetPassword'); | ||
|
||
it('should call navigator method when "Cadastre-se" is clicked', () => { | ||
spyOn(component, 'navigator'); | ||
const registerLink = | ||
fixture.nativeElement.querySelector('.text-blue-brand'); | ||
registerLink.click(); | ||
|
||
expect(component.navigator).toHaveBeenCalledWith('/register'); | ||
}); | ||
}); | ||
}); |
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