Skip to content

Commit

Permalink
build: fix lint & build errs
Browse files Browse the repository at this point in the history
  • Loading branch information
rixcian committed Aug 27, 2024
1 parent 7025c57 commit 7f9218f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 18 deletions.
15 changes: 15 additions & 0 deletions src/core/utils/http_ece.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
declare module 'http_ece' {
interface EceParams {
version: string;
authSecret: string;
dh: string;
privateKey: crypto.ECDH;
salt: string;
}

function decrypt(buffer: Buffer, params: EceParams): Buffer;

export = {
decrypt: decrypt
};
}
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { add } from './utils.js';
export { listen } from './core/listen.js';
export { register } from './core/register.js';
42 changes: 25 additions & 17 deletions src/register.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,32 @@ import { describe, it, expect } from 'vitest';
import { register, type RegisterCredentials } from './core/register.js';

describe('register function', () => {
it('should return a valid credentials (with vapid key)', async () => {
const credentials: RegisterCredentials = await register({
apiKey: process.env.API_KEY!,
appId: process.env.APP_ID!,
projectId: process.env.PROJECT_ID!,
vapidKey: process.env.FCM_VAPID_KEY!,
});
it(
'should return a valid credentials (with vapid key)',
async () => {
const credentials: RegisterCredentials = await register({
apiKey: process.env.API_KEY!,
appId: process.env.APP_ID!,
projectId: process.env.PROJECT_ID!,
vapidKey: process.env.FCM_VAPID_KEY!,
});

expect(credentials).toBeDefined();
}, { timeout: 10000 });
expect(credentials).toBeDefined();
},
{ timeout: 10000 },
);

it('should return a valid credentials (without vapid key)', async () => {
const credentials: RegisterCredentials = await register({
apiKey: process.env.API_KEY!,
appId: process.env.APP_ID!,
projectId: process.env.PROJECT_ID!,
});
it(
'should return a valid credentials (without vapid key)',
async () => {
const credentials: RegisterCredentials = await register({
apiKey: process.env.API_KEY!,
appId: process.env.APP_ID!,
projectId: process.env.PROJECT_ID!,
});

expect(credentials).toBeDefined();
}, { timeout: 10000 });
expect(credentials).toBeDefined();
},
{ timeout: 10000 },
);
});

0 comments on commit 7f9218f

Please sign in to comment.