diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6e7dcf8 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,26 @@ +name: Test + +on: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Check out the repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test diff --git a/config/accounts.example.js b/config/accounts.example.js index 947d2d0..a4ad5ad 100644 --- a/config/accounts.example.js +++ b/config/accounts.example.js @@ -57,7 +57,7 @@ export const ACCOUNTS = [ * @type {{[account_id: string]: string[]}} */ export const ACCOUNT_MAP = { - "account1": ['email.A@example.com', 'email.B@example.com'] + "account1": ['email@example.com', 'email.A@example.com', 'email.B@example.com'] } ; Object.keys(ACCOUNT_MAP).forEach((localId) => assert(ACCOUNTS.find(account => account.sub === localId), `${localId} is specified in map but not in accounts`)); diff --git a/util/accountService.js b/util/accountService.js index d983cb1..6c3d256 100644 --- a/util/accountService.js +++ b/util/accountService.js @@ -47,7 +47,7 @@ class AccountService { continue; } - resolve(AccountService.getAccountById(accountId)); + return resolve(AccountService.getAccountById(accountId)); } throw new Error(`Local account ${expectedMail} not found`);