@friggframework/devtools 2.0.0--canary.405.b81908d.0 → 2.0.0--canary.397.c07f148.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
1
  const path = require('path');
2
2
  const fs = require('fs-extra');
3
3
  const { composeServerlessDefinition } = require('./serverless-template');
4
-
5
4
  const { findNearestBackendPackageJson } = require('@friggframework/core');
6
5
 
7
6
  function createFriggInfrastructure() {
@@ -19,14 +18,7 @@ function createFriggInfrastructure() {
19
18
  const backend = require(backendFilePath);
20
19
  const appDefinition = backend.Definition;
21
20
 
22
- // const serverlessTemplate = require(path.resolve(
23
- // __dirname,
24
- // './serverless-template.js'
25
- // ));
26
- const definition = composeServerlessDefinition(
27
- appDefinition,
28
- backend.IntegrationFactory
29
- );
21
+ const definition = composeServerlessDefinition(appDefinition);
30
22
 
31
23
  return {
32
24
  ...definition,
@@ -102,309 +102,6 @@ const modifyHandlerPaths = (functions) => {
102
102
  return modifiedFunctions;
103
103
  };
104
104
 
105
- // Helper function to create VPC infrastructure resources
106
- const createVPCInfrastructure = (AppDefinition) => {
107
- const vpcResources = {
108
- // VPC
109
- FriggVPC: {
110
- Type: 'AWS::EC2::VPC',
111
- Properties: {
112
- CidrBlock: AppDefinition.vpc.cidrBlock || '10.0.0.0/16',
113
- EnableDnsHostnames: true,
114
- EnableDnsSupport: true,
115
- Tags: [
116
- { Key: 'Name', Value: '${self:service}-${self:provider.stage}-vpc' }
117
- ]
118
- }
119
- },
120
-
121
- // Internet Gateway
122
- FriggInternetGateway: {
123
- Type: 'AWS::EC2::InternetGateway',
124
- Properties: {
125
- Tags: [
126
- { Key: 'Name', Value: '${self:service}-${self:provider.stage}-igw' }
127
- ]
128
- }
129
- },
130
-
131
- // Attach Internet Gateway to VPC
132
- FriggVPCGatewayAttachment: {
133
- Type: 'AWS::EC2::VPCGatewayAttachment',
134
- Properties: {
135
- VpcId: { Ref: 'FriggVPC' },
136
- InternetGatewayId: { Ref: 'FriggInternetGateway' }
137
- }
138
- },
139
-
140
- // Public Subnet for NAT Gateway
141
- FriggPublicSubnet: {
142
- Type: 'AWS::EC2::Subnet',
143
- Properties: {
144
- VpcId: { Ref: 'FriggVPC' },
145
- CidrBlock: '10.0.1.0/24',
146
- AvailabilityZone: { 'Fn::Select': [0, { 'Fn::GetAZs': '' }] },
147
- MapPublicIpOnLaunch: true,
148
- Tags: [
149
- { Key: 'Name', Value: '${self:service}-${self:provider.stage}-public-subnet' }
150
- ]
151
- }
152
- },
153
-
154
- // Private Subnet 1 for Lambda
155
- FriggPrivateSubnet1: {
156
- Type: 'AWS::EC2::Subnet',
157
- Properties: {
158
- VpcId: { Ref: 'FriggVPC' },
159
- CidrBlock: '10.0.2.0/24',
160
- AvailabilityZone: { 'Fn::Select': [0, { 'Fn::GetAZs': '' }] },
161
- Tags: [
162
- { Key: 'Name', Value: '${self:service}-${self:provider.stage}-private-subnet-1' }
163
- ]
164
- }
165
- },
166
-
167
- // Private Subnet 2 for Lambda (different AZ for redundancy)
168
- FriggPrivateSubnet2: {
169
- Type: 'AWS::EC2::Subnet',
170
- Properties: {
171
- VpcId: { Ref: 'FriggVPC' },
172
- CidrBlock: '10.0.3.0/24',
173
- AvailabilityZone: { 'Fn::Select': [1, { 'Fn::GetAZs': '' }] },
174
- Tags: [
175
- { Key: 'Name', Value: '${self:service}-${self:provider.stage}-private-subnet-2' }
176
- ]
177
- }
178
- },
179
-
180
- // Elastic IP for NAT Gateway
181
- FriggNATGatewayEIP: {
182
- Type: 'AWS::EC2::EIP',
183
- Properties: {
184
- Domain: 'vpc',
185
- Tags: [
186
- { Key: 'Name', Value: '${self:service}-${self:provider.stage}-nat-eip' }
187
- ]
188
- },
189
- DependsOn: 'FriggVPCGatewayAttachment'
190
- },
191
-
192
- // NAT Gateway for private subnet internet access
193
- FriggNATGateway: {
194
- Type: 'AWS::EC2::NatGateway',
195
- Properties: {
196
- AllocationId: { 'Fn::GetAtt': ['FriggNATGatewayEIP', 'AllocationId'] },
197
- SubnetId: { Ref: 'FriggPublicSubnet' },
198
- Tags: [
199
- { Key: 'Name', Value: '${self:service}-${self:provider.stage}-nat-gateway' }
200
- ]
201
- }
202
- },
203
-
204
- // Public Route Table
205
- FriggPublicRouteTable: {
206
- Type: 'AWS::EC2::RouteTable',
207
- Properties: {
208
- VpcId: { Ref: 'FriggVPC' },
209
- Tags: [
210
- { Key: 'Name', Value: '${self:service}-${self:provider.stage}-public-rt' }
211
- ]
212
- }
213
- },
214
-
215
- // Public Route to Internet Gateway
216
- FriggPublicRoute: {
217
- Type: 'AWS::EC2::Route',
218
- Properties: {
219
- RouteTableId: { Ref: 'FriggPublicRouteTable' },
220
- DestinationCidrBlock: '0.0.0.0/0',
221
- GatewayId: { Ref: 'FriggInternetGateway' }
222
- },
223
- DependsOn: 'FriggVPCGatewayAttachment'
224
- },
225
-
226
- // Associate Public Subnet with Public Route Table
227
- FriggPublicSubnetRouteTableAssociation: {
228
- Type: 'AWS::EC2::SubnetRouteTableAssociation',
229
- Properties: {
230
- SubnetId: { Ref: 'FriggPublicSubnet' },
231
- RouteTableId: { Ref: 'FriggPublicRouteTable' }
232
- }
233
- },
234
-
235
- // Private Route Table
236
- FriggPrivateRouteTable: {
237
- Type: 'AWS::EC2::RouteTable',
238
- Properties: {
239
- VpcId: { Ref: 'FriggVPC' },
240
- Tags: [
241
- { Key: 'Name', Value: '${self:service}-${self:provider.stage}-private-rt' }
242
- ]
243
- }
244
- },
245
-
246
- // Private Route to NAT Gateway
247
- FriggPrivateRoute: {
248
- Type: 'AWS::EC2::Route',
249
- Properties: {
250
- RouteTableId: { Ref: 'FriggPrivateRouteTable' },
251
- DestinationCidrBlock: '0.0.0.0/0',
252
- NatGatewayId: { Ref: 'FriggNATGateway' }
253
- }
254
- },
255
-
256
- // Associate Private Subnet 1 with Private Route Table
257
- FriggPrivateSubnet1RouteTableAssociation: {
258
- Type: 'AWS::EC2::SubnetRouteTableAssociation',
259
- Properties: {
260
- SubnetId: { Ref: 'FriggPrivateSubnet1' },
261
- RouteTableId: { Ref: 'FriggPrivateRouteTable' }
262
- }
263
- },
264
-
265
- // Associate Private Subnet 2 with Private Route Table
266
- FriggPrivateSubnet2RouteTableAssociation: {
267
- Type: 'AWS::EC2::SubnetRouteTableAssociation',
268
- Properties: {
269
- SubnetId: { Ref: 'FriggPrivateSubnet2' },
270
- RouteTableId: { Ref: 'FriggPrivateRouteTable' }
271
- }
272
- },
273
-
274
- // Security Group for Lambda functions
275
- FriggLambdaSecurityGroup: {
276
- Type: 'AWS::EC2::SecurityGroup',
277
- Properties: {
278
- GroupDescription: 'Security group for Frigg Lambda functions',
279
- VpcId: { Ref: 'FriggVPC' },
280
- SecurityGroupEgress: [
281
- {
282
- IpProtocol: 'tcp',
283
- FromPort: 443,
284
- ToPort: 443,
285
- CidrIp: '0.0.0.0/0',
286
- Description: 'HTTPS outbound'
287
- },
288
- {
289
- IpProtocol: 'tcp',
290
- FromPort: 80,
291
- ToPort: 80,
292
- CidrIp: '0.0.0.0/0',
293
- Description: 'HTTP outbound'
294
- },
295
- {
296
- IpProtocol: 'tcp',
297
- FromPort: 53,
298
- ToPort: 53,
299
- CidrIp: '0.0.0.0/0',
300
- Description: 'DNS TCP'
301
- },
302
- {
303
- IpProtocol: 'udp',
304
- FromPort: 53,
305
- ToPort: 53,
306
- CidrIp: '0.0.0.0/0',
307
- Description: 'DNS UDP'
308
- }
309
- ],
310
- Tags: [
311
- { Key: 'Name', Value: '${self:service}-${self:provider.stage}-lambda-sg' }
312
- ]
313
- }
314
- }
315
- };
316
-
317
- // Add VPC Endpoints for cost optimization
318
- if (AppDefinition.vpc.enableVPCEndpoints !== false) {
319
- // S3 Gateway Endpoint (free)
320
- vpcResources.FriggS3VPCEndpoint = {
321
- Type: 'AWS::EC2::VPCEndpoint',
322
- Properties: {
323
- VpcId: { Ref: 'FriggVPC' },
324
- ServiceName: 'com.amazonaws.${self:provider.region}.s3',
325
- VpcEndpointType: 'Gateway',
326
- RouteTableIds: [
327
- { Ref: 'FriggPrivateRouteTable' }
328
- ]
329
- }
330
- };
331
-
332
- // DynamoDB Gateway Endpoint (free)
333
- vpcResources.FriggDynamoDBVPCEndpoint = {
334
- Type: 'AWS::EC2::VPCEndpoint',
335
- Properties: {
336
- VpcId: { Ref: 'FriggVPC' },
337
- ServiceName: 'com.amazonaws.${self:provider.region}.dynamodb',
338
- VpcEndpointType: 'Gateway',
339
- RouteTableIds: [
340
- { Ref: 'FriggPrivateRouteTable' }
341
- ]
342
- }
343
- };
344
-
345
- // KMS Interface Endpoint (paid, but useful if using KMS)
346
- if (AppDefinition.encryption?.useDefaultKMSForFieldLevelEncryption === true) {
347
- vpcResources.FriggKMSVPCEndpoint = {
348
- Type: 'AWS::EC2::VPCEndpoint',
349
- Properties: {
350
- VpcId: { Ref: 'FriggVPC' },
351
- ServiceName: 'com.amazonaws.${self:provider.region}.kms',
352
- VpcEndpointType: 'Interface',
353
- SubnetIds: [
354
- { Ref: 'FriggPrivateSubnet1' },
355
- { Ref: 'FriggPrivateSubnet2' }
356
- ],
357
- SecurityGroupIds: [
358
- { Ref: 'FriggVPCEndpointSecurityGroup' }
359
- ],
360
- PrivateDnsEnabled: true
361
- }
362
- };
363
- }
364
-
365
- // Secrets Manager Interface Endpoint (paid, but useful for secrets)
366
- vpcResources.FriggSecretsManagerVPCEndpoint = {
367
- Type: 'AWS::EC2::VPCEndpoint',
368
- Properties: {
369
- VpcId: { Ref: 'FriggVPC' },
370
- ServiceName: 'com.amazonaws.${self:provider.region}.secretsmanager',
371
- VpcEndpointType: 'Interface',
372
- SubnetIds: [
373
- { Ref: 'FriggPrivateSubnet1' },
374
- { Ref: 'FriggPrivateSubnet2' }
375
- ],
376
- SecurityGroupIds: [
377
- { Ref: 'FriggVPCEndpointSecurityGroup' }
378
- ],
379
- PrivateDnsEnabled: true
380
- }
381
- };
382
-
383
- // Security Group for VPC Endpoints
384
- vpcResources.FriggVPCEndpointSecurityGroup = {
385
- Type: 'AWS::EC2::SecurityGroup',
386
- Properties: {
387
- GroupDescription: 'Security group for Frigg VPC Endpoints',
388
- VpcId: { Ref: 'FriggVPC' },
389
- SecurityGroupIngress: [
390
- {
391
- IpProtocol: 'tcp',
392
- FromPort: 443,
393
- ToPort: 443,
394
- SourceSecurityGroupId: { Ref: 'FriggLambdaSecurityGroup' },
395
- Description: 'HTTPS from Lambda'
396
- }
397
- ],
398
- Tags: [
399
- { Key: 'Name', Value: '${self:service}-${self:provider.stage}-vpc-endpoint-sg' }
400
- ]
401
- }
402
- };
403
- }
404
-
405
- return vpcResources;
406
- };
407
-
408
105
  const composeServerlessDefinition = (AppDefinition) => {
409
106
  const definition = {
410
107
  frameworkVersion: '>=3.17.0',
@@ -541,25 +238,6 @@ const composeServerlessDefinition = (AppDefinition) => {
541
238
  },
542
239
  ],
543
240
  },
544
- health: {
545
- handler: 'node_modules/@friggframework/core/handlers/routers/health.handler',
546
- events: [
547
- {
548
- http: {
549
- path: '/health',
550
- method: 'GET',
551
- cors: true,
552
- },
553
- },
554
- {
555
- http: {
556
- path: '/health/{proxy+}',
557
- method: 'GET',
558
- cors: true,
559
- },
560
- },
561
- ],
562
- },
563
241
  },
564
242
  resources: {
565
243
  Resources: {
@@ -651,20 +329,6 @@ const composeServerlessDefinition = (AppDefinition) => {
651
329
  },
652
330
  };
653
331
 
654
- definition.provider.environment.BASE_URL = {
655
- 'Fn::Join': [
656
- '',
657
- [
658
- 'https://',
659
- { Ref: 'ApiGatewayRestApi' },
660
- '.execute-api.',
661
- { Ref: 'AWS::Region' },
662
- '.amazonaws.com/',
663
- '${self:provider.stage}',
664
- ],
665
- ],
666
- };
667
-
668
332
  // KMS Configuration based on App Definition
669
333
  if (AppDefinition.encryption?.useDefaultKMSForFieldLevelEncryption === true) {
670
334
  // Add KMS IAM permissions
@@ -689,51 +353,6 @@ const composeServerlessDefinition = (AppDefinition) => {
689
353
  };
690
354
  }
691
355
 
692
- // VPC Configuration based on App Definition
693
- if (AppDefinition.vpc?.enable === true) {
694
- // Create VPC config from App Definition or use auto-created resources
695
- const vpcConfig = {};
696
-
697
- if (AppDefinition.vpc.securityGroupIds) {
698
- // User provided custom security groups
699
- vpcConfig.securityGroupIds = AppDefinition.vpc.securityGroupIds;
700
- } else {
701
- // Use auto-created security group
702
- vpcConfig.securityGroupIds = [{ Ref: 'FriggLambdaSecurityGroup' }];
703
- }
704
-
705
- if (AppDefinition.vpc.subnetIds) {
706
- // User provided custom subnets
707
- vpcConfig.subnetIds = AppDefinition.vpc.subnetIds;
708
- } else {
709
- // Use auto-created private subnets
710
- vpcConfig.subnetIds = [
711
- { Ref: 'FriggPrivateSubnet1' },
712
- { Ref: 'FriggPrivateSubnet2' }
713
- ];
714
- }
715
-
716
- // Set VPC config for Lambda functions
717
- definition.provider.vpc = vpcConfig;
718
-
719
- // Add VPC-related IAM permissions
720
- definition.provider.iamRoleStatements.push({
721
- Effect: 'Allow',
722
- Action: [
723
- 'ec2:CreateNetworkInterface',
724
- 'ec2:DescribeNetworkInterfaces',
725
- 'ec2:DeleteNetworkInterface',
726
- 'ec2:AttachNetworkInterface',
727
- 'ec2:DetachNetworkInterface'
728
- ],
729
- Resource: '*'
730
- });
731
-
732
- // Add VPC infrastructure resources to CloudFormation
733
- const vpcResources = createVPCInfrastructure(AppDefinition);
734
- Object.assign(definition.resources.Resources, vpcResources);
735
- }
736
-
737
356
  // Add integration-specific functions and resources
738
357
  for (const integration of AppDefinition.integrations) {
739
358
  const integrationName = integration.Definition.name;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.405.b81908d.0",
4
+ "version": "2.0.0--canary.397.c07f148.0",
5
5
  "dependencies": {
6
6
  "@babel/eslint-parser": "^7.18.9",
7
7
  "@babel/parser": "^7.25.3",
8
8
  "@babel/traverse": "^7.25.3",
9
- "@friggframework/test": "2.0.0--canary.405.b81908d.0",
9
+ "@friggframework/test": "2.0.0--canary.397.c07f148.0",
10
10
  "@hapi/boom": "^10.0.1",
11
11
  "@inquirer/prompts": "^5.3.8",
12
12
  "axios": "^1.7.2",
@@ -27,8 +27,8 @@
27
27
  "serverless-http": "^2.7.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@friggframework/eslint-config": "2.0.0--canary.405.b81908d.0",
31
- "@friggframework/prettier-config": "2.0.0--canary.405.b81908d.0",
30
+ "@friggframework/eslint-config": "2.0.0--canary.397.c07f148.0",
31
+ "@friggframework/prettier-config": "2.0.0--canary.397.c07f148.0",
32
32
  "prettier": "^2.7.1",
33
33
  "serverless": "3.39.0",
34
34
  "serverless-dotenv-plugin": "^6.0.0",
@@ -60,5 +60,5 @@
60
60
  "publishConfig": {
61
61
  "access": "public"
62
62
  },
63
- "gitHead": "b81908d5f795baf937e4b382dff63dedd40ddceb"
63
+ "gitHead": "c07f148505b5831d3f8be581529be9f0e18b5934"
64
64
  }
package/test/index.js CHANGED
@@ -1,11 +1,9 @@
1
- const {testDefinitionRequiredAuthMethods} = require('./auther-definition-method-tester');
2
- const {createMockIntegration, createMockApiObject} = require('./mock-integration');
3
- const { testAutherDefinition } = require('./auther-definition-tester');
1
+ const { testDefinitionRequiredAuthMethods } = require('./auther-definition-method-tester');
2
+ const { createMockIntegration, createMockApiObject } = require('./mock-integration');
4
3
 
5
4
 
6
5
  module.exports = {
7
6
  createMockIntegration,
8
7
  createMockApiObject,
9
8
  testDefinitionRequiredAuthMethods,
10
- testAutherDefinition,
11
9
  };
@@ -1,8 +1,4 @@
1
1
  const {
2
- Auther,
3
- Credential,
4
- Entity,
5
- IntegrationFactory,
6
2
  createObjectId,
7
3
  } = require('@friggframework/core');
8
4
 
@@ -11,7 +7,6 @@ async function createMockIntegration(
11
7
  userId = null,
12
8
  config = { type: IntegrationClass.Definition.name }
13
9
  ) {
14
- const integrationFactory = new IntegrationFactory([IntegrationClass]);
15
10
  userId = userId || createObjectId();
16
11
 
17
12
  const insertOptions = {
@@ -24,10 +19,8 @@ async function createMockIntegration(
24
19
  const entities = [];
25
20
  for (const moduleName in IntegrationClass.modules) {
26
21
  const ModuleDef = IntegrationClass.Definition.modules[moduleName];
27
- const module = await Auther.getInstance({
28
- definition: ModuleDef,
29
- userId: userId,
30
- });
22
+ // todo: create module using the new architecture
23
+ const module = {}
31
24
  const credential = await module.CredentialModel.findOneAndUpdate(
32
25
  user,
33
26
  { $set: user },
@@ -51,11 +44,8 @@ async function createMockIntegration(
51
44
  );
52
45
  }
53
46
 
54
- const integration = await integrationFactory.createIntegration(
55
- entities,
56
- userId,
57
- config
58
- );
47
+ // todo: create integration using the new architecture
48
+ const integration = {}
59
49
 
60
50
  integration.id = integration.record._id;
61
51
 
@@ -1,125 +0,0 @@
1
- const {
2
- Auther,
3
- ModuleConstants,
4
- createObjectId,
5
- connectToDatabase,
6
- disconnectFromDatabase,
7
- } = require('@friggframework/core');
8
- const { createMockApiObject } = require("./mock-integration");
9
-
10
-
11
- function testAutherDefinition(definition, mocks) {
12
- const getModule = async (params) => {
13
- const module = await Auther.getInstance({
14
- definition,
15
- userId: createObjectId(),
16
- ...params,
17
- });
18
- if (mocks.tokenResponse) {
19
- mocks.getTokenFrom = async function(code) {
20
- await this.setTokens(mocks.tokenResponse);
21
- return mocks.tokenResponse
22
- }
23
- mocks.getTokenFromCode = mocks.getTokenFromCode || mocks.getTokenFrom
24
- mocks.getTokenFromCodeBasicAuthHeader = mocks.getTokenFromCodeBasicAuthHeader || mocks.getTokenFrom
25
- mocks.getTokenFromClientCredentials = mocks.getTokenFromClientCredentials || mocks.getTokenFrom
26
- mocks.getTokenFromUsernamePassword = mocks.getTokenFromUsernamePassword || mocks.getTokenFrom
27
- }
28
- if (mocks.refreshResponse) {
29
- mocks.refreshAccessToken = async function(code) {
30
- await this.setTokens(mocks.refreshResponse);
31
- return mocks.refreshResponse
32
- }
33
- }
34
- module.api = createMockApiObject(jest, module.api, mocks);
35
- return module
36
- }
37
-
38
-
39
- describe(`${definition.moduleName} Module Tests`, () => {
40
- let module, authUrl;
41
- beforeAll(async () => {
42
- await connectToDatabase();
43
- module = await getModule();
44
- });
45
-
46
- afterAll(async () => {
47
- await disconnectFromDatabase();
48
- });
49
-
50
- let requirements, authCallbackParams;
51
- if (definition.API.requesterType === ModuleConstants.authType.oauth2) {
52
- authCallbackParams = mocks.authorizeResponse || mocks.authorizeParams;
53
- describe('getAuthorizationRequirements() test', () => {
54
- it('should return auth requirements', async () => {
55
- requirements = await module.getAuthorizationRequirements();
56
- expect(requirements).toBeDefined();
57
- expect(requirements.type).toEqual(ModuleConstants.authType.oauth2);
58
- expect(requirements.url).toBeDefined();
59
- authUrl = requirements.url;
60
- });
61
- });
62
- } else if (definition.API.requesterType === ModuleConstants.authType.basic) {
63
- // could also confirm authCallbackParams against the auth requirements
64
- authCallbackParams = mocks.authorizeParams
65
- describe('getAuthorizationRequirements() test', () => {
66
- it('should return auth requirements', async () => {
67
- requirements = module.getAuthorizationRequirements();
68
- expect(requirements).toBeDefined();
69
- expect(requirements.type).toEqual(ModuleConstants.authType.basic);
70
- });
71
- });
72
- } else if (definition.API.requesterType === ModuleConstants.authType.apiKey) {
73
- // could also confirm authCallbackParams against the auth requirements
74
- authCallbackParams = mocks.authorizeParams
75
- describe('getAuthorizationRequirements() test', () => {
76
- it('should return auth requirements', async () => {
77
- requirements = module.getAuthorizationRequirements();
78
- expect(requirements).toBeDefined();
79
- expect(requirements.type).toEqual(ModuleConstants.authType.apiKey);
80
- });
81
- });
82
- }
83
-
84
- describe('Authorization requests', () => {
85
- let firstRes;
86
- it('processAuthorizationCallback()', async () => {
87
- firstRes = await module.processAuthorizationCallback(authCallbackParams);
88
- expect(firstRes).toBeDefined();
89
- expect(firstRes.entity_id).toBeDefined();
90
- expect(firstRes.credential_id).toBeDefined();
91
- });
92
- it('retrieves existing entity on subsequent calls', async () => {
93
- const res = await module.processAuthorizationCallback(authCallbackParams);
94
- expect(res).toEqual(firstRes);
95
- });
96
- });
97
-
98
- describe('Test credential retrieval and module instantiation', () => {
99
- it('retrieve by entity id', async () => {
100
- const newModule = await getModule({
101
- userId: module.userId,
102
- entityId: module.entity.id
103
- });
104
- expect(newModule).toBeDefined();
105
- expect(newModule.entity).toBeDefined();
106
- expect(newModule.credential).toBeDefined();
107
- expect(await newModule.testAuth()).toBeTruthy();
108
-
109
- });
110
-
111
- it('retrieve by credential id', async () => {
112
- const newModule = await getModule({
113
- userId: module.userId,
114
- credentialId: module.credential.id
115
- });
116
- expect(newModule).toBeDefined();
117
- expect(newModule.credential).toBeDefined();
118
- expect(await newModule.testAuth()).toBeTruthy();
119
- });
120
- });
121
- });
122
- }
123
-
124
- module.exports = { testAutherDefinition }
125
-