|
1 | 1 |
|
2 |
| -import func from '../libs/index' |
| 2 | +import { |
| 3 | + ServerlessNestjsApplicationFactory |
| 4 | +} from '../libs/index' |
| 5 | +import { APIGatewayProxyEvent, Context } from 'aws-lambda' |
3 | 6 |
|
4 |
| -describe('dummy', () => { |
5 |
| - it('test', () => { |
6 |
| - expect(func('John')).toEqual('Hello John !') |
7 |
| - }) |
| 7 | +const event = { |
| 8 | + requestId: 'offlineContext_requestId_ck74ytlnx000midk328eoe82y', |
| 9 | + requestTimeEpoch: 1582821111007, |
| 10 | + httpMethod: 'GET', |
| 11 | + path: '/server', |
| 12 | + stage: 'development', |
| 13 | + resourcePath: '/{proxy*}', |
| 14 | + hostname: 'okamotoakanombp.lan', |
| 15 | + pid: 48613, |
| 16 | + level: 'INFO', |
| 17 | + body: null, |
| 18 | + headers: { |
| 19 | + Host: 'localhost:3000', |
| 20 | + 'User-Agent': 'curl/7.64.1', |
| 21 | + Accept: '*/*' |
| 22 | + }, |
| 23 | + multiValueHeaders: { |
| 24 | + Host: [ |
| 25 | + 'localhost:3000' |
| 26 | + ], |
| 27 | + 'User-Agent': [ |
| 28 | + 'curl/7.64.1' |
| 29 | + ], |
| 30 | + Accept: [ |
| 31 | + '*/*' |
| 32 | + ] |
| 33 | + }, |
| 34 | + multiValueQueryStringParameters: null, |
| 35 | + pathParameters: { |
| 36 | + proxy: 'server' |
| 37 | + }, |
| 38 | + queryStringParameters: null, |
| 39 | + requestContext: { |
| 40 | + accountId: 'offlineContext_accountId', |
| 41 | + apiId: 'offlineContext_apiId', |
| 42 | + authorizer: { |
| 43 | + principalId: 'offlineContext_authorizer_principalId' |
| 44 | + }, |
| 45 | + httpMethod: 'GET', |
| 46 | + identity: { |
| 47 | + accountId: 'offlineContext_accountId', |
| 48 | + apiKey: 'offlineContext_apiKey', |
| 49 | + caller: 'offlineContext_caller', |
| 50 | + cognitoAuthenticationProvider: 'offlineContext_cognitoAuthenticationProvider', |
| 51 | + cognitoAuthenticationType: 'offlineContext_cognitoAuthenticationType', |
| 52 | + cognitoIdentityId: 'offlineContext_cognitoIdentityId', |
| 53 | + cognitoIdentityPoolId: 'offlineContext_cognitoIdentityPoolId', |
| 54 | + sourceIp: '127.0.0.1', |
| 55 | + user: 'offlineContext_user', |
| 56 | + userAgent: 'curl/7.64.1', |
| 57 | + userArn: 'offlineContext_userArn' |
| 58 | + }, |
| 59 | + protocol: 'HTTP/1.1', |
| 60 | + requestId: 'offlineContext_requestId_ck74ytlnx000midk328eoe82y', |
| 61 | + requestTimeEpoch: 1582821111007, |
| 62 | + resourceId: 'offlineContext_resourceId', |
| 63 | + resourcePath: '/{proxy*}', |
| 64 | + stage: 'development' |
| 65 | + }, |
| 66 | + resource: '/{proxy*}', |
| 67 | + stageVariables: null, |
| 68 | + isOffline: true |
| 69 | +} as any as APIGatewayProxyEvent |
| 70 | + |
| 71 | +describe('ServerlessNestjsApplicationFactory', () => { |
| 72 | + it('test', async () => { |
| 73 | + const app = new ServerlessNestjsApplicationFactory({}) |
| 74 | + expect(await app.create(event, {} as Context)).toHaveReturned() |
| 75 | + }) |
8 | 76 | })
|
0 commit comments