Skip to content

Commit 5af9a67

Browse files
Copilotesoadamo
andauthored
Fix failing accountService test + add PR CI workflow (#21)
* fix: add email@example.com to ACCOUNT_MAP, fix resolve/throw logic, add PR test workflow Agent-Logs-Url: https://github.com/esoadamo/cloudflare-oidc-proxy/sessions/e9ce0f1a-7740-49c3-a0c7-8502690cf4cf Co-authored-by: esoadamo <15877754+esoadamo@users.noreply.github.com> * fix: restrict GITHUB_TOKEN permissions in test workflow Agent-Logs-Url: https://github.com/esoadamo/cloudflare-oidc-proxy/sessions/e9ce0f1a-7740-49c3-a0c7-8502690cf4cf Co-authored-by: esoadamo <15877754+esoadamo@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: esoadamo <15877754+esoadamo@users.noreply.github.com>
1 parent 511c755 commit 5af9a67

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: read
11+
12+
steps:
13+
- name: Check out the repository
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '22'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Run tests
26+
run: npm test

config/accounts.example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const ACCOUNTS = [
5757
* @type {{[account_id: string]: string[]}}
5858
*/
5959
export const ACCOUNT_MAP = {
60-
"account1": ['email.A@example.com', 'email.B@example.com']
60+
"account1": ['email@example.com', 'email.A@example.com', 'email.B@example.com']
6161
} ;
6262

6363
Object.keys(ACCOUNT_MAP).forEach((localId) => assert(ACCOUNTS.find(account => account.sub === localId), `${localId} is specified in map but not in accounts`));

util/accountService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class AccountService {
4747
continue;
4848
}
4949

50-
resolve(AccountService.getAccountById(accountId));
50+
return resolve(AccountService.getAccountById(accountId));
5151
}
5252

5353
throw new Error(`Local account ${expectedMail} not found`);

0 commit comments

Comments
 (0)