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

Commit 51a2dea

Browse files
Copilotleandro3810
andauthored
fix: tighten workflow checks and accessibility feedback
Agent-Logs-Url: https://github.com/leandro3810/dev/sessions/b8c2e99f-f555-4892-9efc-e840b21d6eb2 Co-authored-by: leandro3810 <174205117+leandro3810@users.noreply.github.com>
1 parent dd4a4d4 commit 51a2dea

4 files changed

Lines changed: 20 additions & 5 deletions

File tree

.github/workflows/azure-webapps-node.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55

66
env:
77
AZURE_WEBAPP_NAME: your-app-name
8+
AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
89
NODE_VERSION: '20.x'
910

1011
permissions:
@@ -43,7 +44,7 @@ jobs:
4344
path: release
4445

4546
deploy:
46-
if: ${{ env.AZURE_WEBAPP_NAME != 'your-app-name' && secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
47+
if: ${{ env.AZURE_WEBAPP_NAME != 'your-app-name' && env.AZURE_WEBAPP_PUBLISH_PROFILE != '' }}
4748
permissions:
4849
contents: none
4950
runs-on: ubuntu-latest
@@ -63,5 +64,5 @@ jobs:
6364
uses: azure/webapps-deploy@v2
6465
with:
6566
app-name: ${{ env.AZURE_WEBAPP_NAME }}
66-
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
67+
publish-profile: ${{ env.AZURE_WEBAPP_PUBLISH_PROFILE }}
6768
package: .

public/contato.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ <h1>Vamos conversar sobre seu projeto</h1>
4141
form.addEventListener('submit', async (event) => {
4242
event.preventDefault();
4343
feedback.textContent = 'Enviando...';
44+
await new Promise((resolve) => setTimeout(resolve, 150));
4445

4546
const payload = Object.fromEntries(new FormData(form).entries());
4647

public/login.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ <h1>Acesso demonstrativo</h1>
3535
form.addEventListener('submit', async (event) => {
3636
event.preventDefault();
3737
feedback.textContent = 'Enviando...';
38+
await new Promise((resolve) => setTimeout(resolve, 150));
3839

3940
const payload = Object.fromEntries(new FormData(form).entries());
4041

test/app.test.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,28 @@ test('returns the profile API payload', async () => {
3535
assert.equal(Array.isArray(body.projects), true);
3636
});
3737

38-
test('validates login payloads', async () => {
38+
test('rejects login with invalid email', async () => {
3939
const response = await fetch(`${baseUrl}/api/login`, {
4040
method: 'POST',
4141
headers: { 'Content-Type': 'application/json' },
42-
body: JSON.stringify({ email: 'invalido', password: '123' }),
42+
body: JSON.stringify({ email: 'invalido', password: '123456' }),
4343
});
4444
const body = await response.json();
4545

4646
assert.equal(response.status, 400);
47-
assert.match(body.error, /email válido|senha/);
47+
assert.match(body.error, /email válido/);
48+
});
49+
50+
test('rejects login with short password', async () => {
51+
const response = await fetch(`${baseUrl}/api/login`, {
52+
method: 'POST',
53+
headers: { 'Content-Type': 'application/json' },
54+
body: JSON.stringify({ email: 'leandro@example.com', password: '123' }),
55+
});
56+
const body = await response.json();
57+
58+
assert.equal(response.status, 400);
59+
assert.match(body.error, /6 caracteres/);
4860
});
4961

5062
test('accepts valid contact submissions', async () => {

0 commit comments

Comments
 (0)