Skip to content

Instantly share code, notes, and snippets.

View s-barrah's full-sized avatar

Sidney Barrah s-barrah

View GitHub Profile
import * as chai from 'chai';
import handler from '../../../lib/actions/handler';
const expect = chai.expect;
const requestData = {
name: "New List"
}
import fetch from 'node-fetch';
const {
BASE_URL,
AUDIENCE,
AUTH0_CLIENT_ID,
AUTH0_CLIENT_SECRET,
TOKEN_ISSUER
} = process.env
export default {
jwtAuth: {
handler: 'handler.jwtAuth',
},
createList: {
handler: 'handler.createList',
events: [
{
http: {
method: 'POST',
import {
APIGatewayAuthorizerEvent,
Context,
Callback
} from 'aws-lambda';
import AuthService from "../../services/auth.service";
export const jwtAuth = async (event: APIGatewayAuthorizerEvent, _context: Context, callback: Callback) => {
import jwt, { VerifyOptions, JwtHeader } from 'jsonwebtoken';
import jwks from 'jwks-rsa';
import { APIGatewayAuthorizerEvent, PolicyDocument } from 'aws-lambda';
interface IPayload {
iss: string;
sub: string;
aud: string;
iat: number;
exp: number;
{
"compilerOptions": {
"lib": ["es2017"],
"removeComments": true,
"moduleResolution": "node",
"noUnusedLocals": true,
"noUnusedParameters": true,
"sourceMap": true,
"target": "es2017",
"outDir": "./dist",
import * as chai from 'chai';
import handler from '../../../lib/actions/handler';
const expect = chai.expect;
const requestData = {
name: 12344567
}
import * as chai from 'chai';
import handler from '../../../lib/actions/handler';
type Response = {
data: any;
message: string;
status: string;
}
import fetch from 'node-fetch';
const BASE_URL = process.env.BASE_URL;
const post = (data = {}, url = '') => {
return new Promise((resolve, reject) => {
return fetch(BASE_URL + url, {
method: 'post',
body: JSON.stringify(data),
headers: { 'Content-Type': 'application/json' },
import * as chai from 'chai';
import { validateAgainstConstraints, createChunks } from '../../../src/utils/util';
const expect = chai.expect;
describe('Util Functions', () => {
describe('validateAgainstConstraints function', () => {
const mockData = {