Skip to content

Commit

Permalink
Merge pull request #250 from jaredwray/upgrading-ecto-to-2.2.2
Browse files Browse the repository at this point in the history
upgrading ecto to 2.2.2
  • Loading branch information
jaredwray authored Sep 30, 2023
2 parents 5cd9b4c + 4f9c515 commit b7ae0ce
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:
- name: Build
run: npm run build

- name: Testing
- name: Testing
env:
FIREBASE_CERT: ${{ secrets.FIREBASE_CERT }}
run: npm run test

- name: Code Coverage
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ jobs:
- name: Build
run: npm run build

- name: Testing
- name: Testing
env:
FIREBASE_CERT: ${{ secrets.FIREBASE_CERT }}
run: npm run test

- name: Code Coverage
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@aws-sdk/client-ses": "^3.405.0",
"@aws-sdk/client-sns": "^3.405.0",
"@sendgrid/mail": "^7.7.0",
"ecto": "^2.2.0",
"ecto": "^2.2.2",
"firebase-admin": "^11.10.1",
"fs-extra": "^11.1.1",
"got": "^13.0.0",
Expand Down
25 changes: 16 additions & 9 deletions test/airhorn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@
import {jest} from '@jest/globals';
import {Options} from '../src/options.js';
import {ProviderType} from '../src/provider-type.js';
import {Airhorn} from '../src/airhorn.js';
import {FirebaseMessaging} from '../src/providers/firebase-messaging.js';
import {TestingData} from './testing-data.js';

// eslint-disable-next-line n/prefer-global/process
const FIREBASE_CERT = process.env.FIREBASE_CERT ?? '{}';

jest.mock('firebase-admin', () => ({
apps: ['testAppId'],
initializeApp: jest.fn(),
messaging: jest.fn(),
apps: [],
credential: {
cert: jest.fn(),
},
}));

const {FirebaseMessaging} = await import ('../src/providers/firebase-messaging.js');
const {Airhorn} = await import('../src/airhorn.js');

// eslint-disable-next-line n/prefer-global/process
const WEBHOOK_MOCK_URL = process.env.WEBHOOK_MOCK_URL ?? 'https://httpbin.org/post';

Expand Down Expand Up @@ -64,7 +71,7 @@ test('Airhorn - Get Loaded Providers', () => {
TWILIO_SMS_ACCOUNT_SID: 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
TWILIO_SMS_AUTH_TOKEN: 'baz',
TWILIO_SENDGRID_API_KEY: 'foo',
FIREBASE_CERT: 'bar',
FIREBASE_CERT,
});

expect(airhorn.providers.providers.length).toEqual(4);
Expand Down Expand Up @@ -123,7 +130,7 @@ test('Airhorn - Send Friendly SMS', async () => {
test('Airhorn - Send Mobile Push with Notification', async () => {
const options = {
TEMPLATE_PATH: './test/templates',
FIREBASE_CERT: 'this.json',
FIREBASE_CERT,
};
const airhorn = new Airhorn(options);

Expand All @@ -133,7 +140,7 @@ test('Airhorn - Send Mobile Push with Notification', async () => {
};

airhorn.providers.removeProvider('firebase-messaging');
const firebaseAdmin = new FirebaseMessaging('this.json');
const firebaseAdmin = new FirebaseMessaging('{}');
firebaseAdmin.client = {
send: jest.fn().mockReturnValue({}),
} as any;
Expand All @@ -145,7 +152,7 @@ test('Airhorn - Send Mobile Push with Notification', async () => {
test('Airhorn - Send Friendly Mobile Push with Notification', async () => {
const options = {
TEMPLATE_PATH: './test/templates',
FIREBASE_CERT: 'this.json',
FIREBASE_CERT,
};
const airhorn = new Airhorn(options);

Expand All @@ -155,7 +162,7 @@ test('Airhorn - Send Friendly Mobile Push with Notification', async () => {
};

airhorn.providers.removeProvider('firebase-messaging');
const firebaseAdmin = new FirebaseMessaging('this.json');
const firebaseAdmin = new FirebaseMessaging(FIREBASE_CERT);
firebaseAdmin.client = {
send: jest.fn().mockReturnValue({}),
} as any;
Expand Down

0 comments on commit b7ae0ce

Please sign in to comment.