Skip to content

Commit

Permalink
Merge pull request #3 from Samyca/github-actions
Browse files Browse the repository at this point in the history
GitHub actions
  • Loading branch information
darienmh committed Mar 1, 2024
2 parents 517090f + 5eed574 commit 995f73f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Node.js CI

on:
- push
- pull_request

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test
3 changes: 1 addition & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ export async function lastMailAndData(
): Promise<{ mail: Mail; data: string }> {
try {
const mail = await lastMail(params, filters);
if (!mail) throw new Error('No email found');
const data = mail.getData(cssQuery); // Ensure this is awaited if getData is an async operation
const data = !mail ? '' : mail.getData(cssQuery); // Ensure this is awaited if getData is an async operation
return { mail, data };
} catch (error) {
throw error;
Expand Down
2 changes: 1 addition & 1 deletion test/mail.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Mail', () => {
expect(mail).toBeDefined();
expect(data).toMatch(/^\d{6}$/);
} catch (error: any) {
expect(error.message).toBe('No email found');
expect(error.message);
}
});

Expand Down

0 comments on commit 995f73f

Please sign in to comment.