@pwrdrvr/microapps-datalib 1.2.0-beta.7 → 1.2.0-beta.8
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.
- package/package.json +6 -5
- package/src/models/application.spec.ts +0 -202
- package/src/models/rules.spec.ts +0 -49
- package/src/models/version.spec.ts +0 -171
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pwrdrvr/microapps-datalib",
|
|
3
|
-
"version": "1.2.0-beta.
|
|
3
|
+
"version": "1.2.0-beta.8",
|
|
4
4
|
"description": "Data library for the microapps framework",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://github.com/pwrdrvr/microapps-core#readme",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aws-sdk/client-dynamodb": "^3.
|
|
28
|
-
"@aws-sdk/lib-dynamodb": "^3.
|
|
27
|
+
"@aws-sdk/client-dynamodb": "^3.1024.0",
|
|
28
|
+
"@aws-sdk/lib-dynamodb": "^3.1024.0",
|
|
29
29
|
"class-transformer": "0.5.1",
|
|
30
30
|
"tslib": "2.5.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@aws-sdk/client-dynamodb": "3.
|
|
34
|
-
"@aws-sdk/lib-dynamodb": "3.
|
|
33
|
+
"@aws-sdk/client-dynamodb": "3.1024.0",
|
|
34
|
+
"@aws-sdk/lib-dynamodb": "3.1024.0",
|
|
35
35
|
"@types/node-fetch": "^2.5.8",
|
|
36
36
|
"jest-dynalite": "3.6.1",
|
|
37
37
|
"node-fetch": "^2.6.1"
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"files": [
|
|
40
40
|
"dist",
|
|
41
41
|
"src",
|
|
42
|
+
"!src/**/*.spec.ts",
|
|
42
43
|
"package.json",
|
|
43
44
|
"LICENSE"
|
|
44
45
|
]
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import 'jest-dynalite/withDb';
|
|
2
|
-
import * as dynamodb from '@aws-sdk/client-dynamodb';
|
|
3
|
-
import { DBManager } from '../manager';
|
|
4
|
-
import { Application } from './application';
|
|
5
|
-
import { Version } from './version';
|
|
6
|
-
import { Rules } from './rules';
|
|
7
|
-
|
|
8
|
-
let dynamoClient: dynamodb.DynamoDBClient;
|
|
9
|
-
let dbManager: DBManager;
|
|
10
|
-
|
|
11
|
-
const TEST_TABLE_NAME = 'microapps';
|
|
12
|
-
|
|
13
|
-
describe('application records', () => {
|
|
14
|
-
beforeAll(() => {
|
|
15
|
-
dynamoClient = new dynamodb.DynamoDBClient({
|
|
16
|
-
endpoint: process.env.MOCK_DYNAMODB_ENDPOINT,
|
|
17
|
-
tls: false,
|
|
18
|
-
region: 'local',
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// Init the DB manager to point it at the right table
|
|
22
|
-
dbManager = new DBManager({ dynamoClient, tableName: TEST_TABLE_NAME });
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
afterAll(() => {
|
|
26
|
-
dynamoClient.destroy();
|
|
27
|
-
}, 20000);
|
|
28
|
-
|
|
29
|
-
it('saving an application should create two records', async () => {
|
|
30
|
-
const application = new Application();
|
|
31
|
-
application.AppName = 'Cat';
|
|
32
|
-
application.DisplayName = 'Dog';
|
|
33
|
-
|
|
34
|
-
await application.Save(dbManager);
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
const { Item } = await dbManager.ddbDocClient.get({
|
|
38
|
-
TableName: TEST_TABLE_NAME,
|
|
39
|
-
Key: { PK: 'appname#cat', SK: 'application' },
|
|
40
|
-
});
|
|
41
|
-
expect(Item).toBeDefined();
|
|
42
|
-
expect(Item?.PK).toBe('appname#cat');
|
|
43
|
-
expect(Item?.SK).toBe('application');
|
|
44
|
-
expect(Item?.AppName).toBe('cat');
|
|
45
|
-
expect(Item?.DisplayName).toBe('Dog');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
{
|
|
49
|
-
const { Item } = await dbManager.ddbDocClient.get({
|
|
50
|
-
TableName: TEST_TABLE_NAME,
|
|
51
|
-
Key: { PK: 'applications', SK: 'appname#cat' },
|
|
52
|
-
// ProjectionExpression: 'PK,SK,AppName,DisplayName',
|
|
53
|
-
});
|
|
54
|
-
expect(Item).toBeDefined();
|
|
55
|
-
expect(Item?.PK).toBe('applications');
|
|
56
|
-
expect(Item?.SK).toBe('appname#cat');
|
|
57
|
-
expect(Item?.AppName).toBe('cat');
|
|
58
|
-
expect(Item?.DisplayName).toBe('Dog');
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('load function should load records', async () => {
|
|
63
|
-
let application = new Application();
|
|
64
|
-
application.AppName = 'App1';
|
|
65
|
-
application.DisplayName = 'Application One';
|
|
66
|
-
await application.Save(dbManager);
|
|
67
|
-
|
|
68
|
-
application = new Application();
|
|
69
|
-
application.AppName = 'App2';
|
|
70
|
-
application.DisplayName = 'Application Two';
|
|
71
|
-
await application.Save(dbManager);
|
|
72
|
-
|
|
73
|
-
{
|
|
74
|
-
const record = await Application.Load({ dbManager, key: { AppName: 'App1' } });
|
|
75
|
-
|
|
76
|
-
expect(record.PK).toBe('appname#app1');
|
|
77
|
-
expect(record.SK).toBe('application');
|
|
78
|
-
expect(record.AppName).toBe('app1');
|
|
79
|
-
expect(record.DisplayName).toBe('Application One');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
const record = await Application.Load({ dbManager, key: { AppName: 'App2' } });
|
|
84
|
-
|
|
85
|
-
expect(record.PK).toBe('appname#app2');
|
|
86
|
-
expect(record.SK).toBe('application');
|
|
87
|
-
expect(record.AppName).toBe('app2');
|
|
88
|
-
expect(record.DisplayName).toBe('Application Two');
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('Load should handle missing records', async () => {
|
|
93
|
-
const record = await Application.Load({ dbManager, key: { AppName: 'App1' } });
|
|
94
|
-
expect(record).toBeUndefined();
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('LoadAllAppsAsync should return all applications', async () => {
|
|
98
|
-
let application = new Application();
|
|
99
|
-
application.AppName = 'Bpp1';
|
|
100
|
-
application.DisplayName = 'Bpplication One';
|
|
101
|
-
await application.Save(dbManager);
|
|
102
|
-
|
|
103
|
-
application = new Application();
|
|
104
|
-
application.AppName = 'Bpp2';
|
|
105
|
-
application.DisplayName = 'Bpplication Two';
|
|
106
|
-
await application.Save(dbManager);
|
|
107
|
-
|
|
108
|
-
const applications = await Application.LoadAllApps(dbManager);
|
|
109
|
-
expect(applications).toBeDefined();
|
|
110
|
-
const appOne = applications.find((value) => {
|
|
111
|
-
return value.AppName === 'bpp1';
|
|
112
|
-
});
|
|
113
|
-
expect(appOne).toBeDefined();
|
|
114
|
-
expect(appOne).toHaveProperty('AppName');
|
|
115
|
-
expect(appOne?.AppName).toBe('bpp1');
|
|
116
|
-
expect(appOne?.DisplayName).toBe('Bpplication One');
|
|
117
|
-
|
|
118
|
-
const appTwo = applications.find((value) => {
|
|
119
|
-
return value.AppName === 'bpp2';
|
|
120
|
-
});
|
|
121
|
-
expect(appTwo).toBeDefined();
|
|
122
|
-
expect(appTwo).toHaveProperty('AppName');
|
|
123
|
-
expect(appTwo?.AppName).toBe('bpp2');
|
|
124
|
-
expect(appTwo?.DisplayName).toBe('Bpplication Two');
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('should get versions and rules when asked', async () => {
|
|
128
|
-
const app = new Application({
|
|
129
|
-
AppName: 'Bat',
|
|
130
|
-
DisplayName: 'Bat App',
|
|
131
|
-
});
|
|
132
|
-
await app.Save(dbManager);
|
|
133
|
-
|
|
134
|
-
const version = new Version({
|
|
135
|
-
AppName: 'Bat',
|
|
136
|
-
DefaultFile: 'bat.html',
|
|
137
|
-
IntegrationID: 'abcd',
|
|
138
|
-
SemVer: '3.2.1-beta0',
|
|
139
|
-
Status: 'deployed',
|
|
140
|
-
Type: 'lambda',
|
|
141
|
-
});
|
|
142
|
-
await version.Save(dbManager);
|
|
143
|
-
|
|
144
|
-
const rules = new Rules({
|
|
145
|
-
AppName: 'Bat',
|
|
146
|
-
Version: 0,
|
|
147
|
-
RuleSet: { default: { SemVer: '3.2.1-beta0', AttributeName: '', AttributeValue: '' } },
|
|
148
|
-
});
|
|
149
|
-
await rules.Save(dbManager);
|
|
150
|
-
|
|
151
|
-
const versAndRules = await Application.GetVersionsAndRules({
|
|
152
|
-
dbManager,
|
|
153
|
-
key: { AppName: 'bat' },
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
expect(versAndRules).toHaveProperty('Versions');
|
|
157
|
-
expect(versAndRules).toHaveProperty('Rules');
|
|
158
|
-
expect(versAndRules.Rules).toHaveProperty('RuleSet');
|
|
159
|
-
expect(versAndRules.Rules.RuleSet).toHaveProperty('default');
|
|
160
|
-
expect(versAndRules.Rules.RuleSet.default).toHaveProperty('SemVer');
|
|
161
|
-
expect(versAndRules.Rules.RuleSet.default.SemVer).toBe('3.2.1-beta0');
|
|
162
|
-
expect(versAndRules.Versions.length).toBe(1);
|
|
163
|
-
expect(versAndRules.Versions[0].SemVer).toBe('3.2.1-beta0');
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it('should update default rule', async () => {
|
|
167
|
-
const app = new Application({
|
|
168
|
-
AppName: 'Bat2',
|
|
169
|
-
DisplayName: 'Bat App',
|
|
170
|
-
});
|
|
171
|
-
await app.Save(dbManager);
|
|
172
|
-
|
|
173
|
-
const version = new Version({
|
|
174
|
-
AppName: 'Bat2',
|
|
175
|
-
DefaultFile: 'bat.html',
|
|
176
|
-
IntegrationID: 'abcd',
|
|
177
|
-
SemVer: '3.2.1-beta0',
|
|
178
|
-
Status: 'deployed',
|
|
179
|
-
Type: 'lambda',
|
|
180
|
-
});
|
|
181
|
-
await version.Save(dbManager);
|
|
182
|
-
|
|
183
|
-
const rules = new Rules({
|
|
184
|
-
AppName: 'Bat2',
|
|
185
|
-
Version: 0,
|
|
186
|
-
RuleSet: { default: { SemVer: '3.2.1-beta0', AttributeName: '', AttributeValue: '' } },
|
|
187
|
-
});
|
|
188
|
-
await rules.Save(dbManager);
|
|
189
|
-
|
|
190
|
-
// Check version before update
|
|
191
|
-
let versAndRules = await Application.GetVersionsAndRules({
|
|
192
|
-
dbManager,
|
|
193
|
-
key: { AppName: 'bat2' },
|
|
194
|
-
});
|
|
195
|
-
expect(versAndRules.Rules.RuleSet.default.SemVer).toBe('3.2.1-beta0');
|
|
196
|
-
|
|
197
|
-
// Update default version
|
|
198
|
-
await Application.UpdateDefaultRule({ dbManager, key: { AppName: 'bat2', SemVer: '3.2.2' } });
|
|
199
|
-
versAndRules = await Application.GetVersionsAndRules({ dbManager, key: { AppName: 'bat2' } });
|
|
200
|
-
expect(versAndRules.Rules.RuleSet.default.SemVer).toBe('3.2.2');
|
|
201
|
-
});
|
|
202
|
-
});
|
package/src/models/rules.spec.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import 'jest-dynalite/withDb';
|
|
2
|
-
import * as dynamodb from '@aws-sdk/client-dynamodb';
|
|
3
|
-
import { DBManager } from '../manager';
|
|
4
|
-
import { Rules } from './rules';
|
|
5
|
-
|
|
6
|
-
let dynamoClient: dynamodb.DynamoDBClient;
|
|
7
|
-
let dbManager: DBManager;
|
|
8
|
-
|
|
9
|
-
const TEST_TABLE_NAME = 'microapps';
|
|
10
|
-
|
|
11
|
-
describe('rules records', () => {
|
|
12
|
-
beforeAll(() => {
|
|
13
|
-
dynamoClient = new dynamodb.DynamoDBClient({
|
|
14
|
-
endpoint: process.env.MOCK_DYNAMODB_ENDPOINT,
|
|
15
|
-
tls: false,
|
|
16
|
-
region: 'local',
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// Init the DB manager to point it at the right table
|
|
20
|
-
dbManager = new DBManager({ dynamoClient, tableName: TEST_TABLE_NAME });
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
afterAll(() => {
|
|
24
|
-
dynamoClient.destroy();
|
|
25
|
-
}, 20000);
|
|
26
|
-
|
|
27
|
-
it('saving rules should create 1 record', async () => {
|
|
28
|
-
const rules = new Rules();
|
|
29
|
-
rules.AppName = 'Cat';
|
|
30
|
-
rules.Version = 0;
|
|
31
|
-
rules.RuleSet.default = { SemVer: '1.2.3', AttributeName: '', AttributeValue: '' };
|
|
32
|
-
|
|
33
|
-
await rules.Save(dbManager);
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
const record = await Rules.Load({ dbManager, key: { AppName: 'Cat' } });
|
|
37
|
-
|
|
38
|
-
expect(record).toBeDefined();
|
|
39
|
-
expect(record.PK).toBe('appname#cat');
|
|
40
|
-
expect(record.SK).toBe('rules');
|
|
41
|
-
expect(record.AppName).toBe('cat');
|
|
42
|
-
expect(record.Version).toBe(0);
|
|
43
|
-
expect(record).toHaveProperty('RuleSet');
|
|
44
|
-
expect(record.RuleSet).toHaveProperty('default');
|
|
45
|
-
expect(record.RuleSet.default).toHaveProperty('SemVer');
|
|
46
|
-
expect(record.RuleSet.default.SemVer).toBe('1.2.3');
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import 'jest-dynalite/withDb';
|
|
2
|
-
import * as dynamodb from '@aws-sdk/client-dynamodb';
|
|
3
|
-
import { DBManager } from '../manager';
|
|
4
|
-
import { Version } from './version';
|
|
5
|
-
|
|
6
|
-
let dynamoClient: dynamodb.DynamoDBClient;
|
|
7
|
-
let dbManager: DBManager;
|
|
8
|
-
|
|
9
|
-
const TEST_TABLE_NAME = 'microapps';
|
|
10
|
-
|
|
11
|
-
describe('version records', () => {
|
|
12
|
-
beforeAll(() => {
|
|
13
|
-
dynamoClient = new dynamodb.DynamoDBClient({
|
|
14
|
-
endpoint: process.env.MOCK_DYNAMODB_ENDPOINT,
|
|
15
|
-
tls: false,
|
|
16
|
-
region: 'local',
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// Init the DB manager to point it at the right table
|
|
20
|
-
dbManager = new DBManager({ dynamoClient, tableName: TEST_TABLE_NAME });
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
afterAll(() => {
|
|
24
|
-
dynamoClient.destroy();
|
|
25
|
-
}, 20000);
|
|
26
|
-
|
|
27
|
-
describe('Type API Gateway', () => {
|
|
28
|
-
it('saving a version should create one record', async () => {
|
|
29
|
-
const version = new Version();
|
|
30
|
-
version.AppName = 'Cat';
|
|
31
|
-
version.SemVer = '1.2.3-Beta4';
|
|
32
|
-
version.Status = 'pending';
|
|
33
|
-
version.Type = 'lambda';
|
|
34
|
-
version.DefaultFile = 'index.html';
|
|
35
|
-
version.IntegrationID = 'abcd';
|
|
36
|
-
version.RouteIDAppVersion = '123';
|
|
37
|
-
version.RouteIDAppVersionSplat = '456';
|
|
38
|
-
|
|
39
|
-
await version.Save(dbManager);
|
|
40
|
-
|
|
41
|
-
const { Item } = await dbManager.ddbDocClient.get({
|
|
42
|
-
TableName: dbManager.tableName,
|
|
43
|
-
Key: { PK: 'appname#cat', SK: 'version#1.2.3-beta4' },
|
|
44
|
-
});
|
|
45
|
-
expect(Item).toBeDefined();
|
|
46
|
-
expect(Item?.PK).toBe('appname#cat');
|
|
47
|
-
expect(Item?.SK).toBe('version#1.2.3-beta4');
|
|
48
|
-
expect(Item?.AppName).toBe('cat');
|
|
49
|
-
expect(Item?.SemVer).toBe('1.2.3-Beta4');
|
|
50
|
-
expect(Item?.Status).toBe('pending');
|
|
51
|
-
expect(Item?.Type).toBe('lambda');
|
|
52
|
-
expect(Item?.DefaultFile).toBe('index.html');
|
|
53
|
-
expect(Item?.IntegrationID).toBe('abcd');
|
|
54
|
-
expect(Item?.RouteIDAppVersion).toEqual('123');
|
|
55
|
-
expect(Item?.RouteIDAppVersionSplat).toEqual('456');
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('load 1 version should load 1 version', async () => {
|
|
59
|
-
let version = new Version();
|
|
60
|
-
version.AppName = 'Dog';
|
|
61
|
-
version.SemVer = '1.2.3-Beta5';
|
|
62
|
-
version.Status = 'pending';
|
|
63
|
-
version.Type = 'lambda';
|
|
64
|
-
version.DefaultFile = 'index.html';
|
|
65
|
-
version.IntegrationID = 'abcd';
|
|
66
|
-
|
|
67
|
-
await version.Save(dbManager);
|
|
68
|
-
|
|
69
|
-
version = new Version();
|
|
70
|
-
version.AppName = 'Dog';
|
|
71
|
-
version.SemVer = '1.2.3-Beta6';
|
|
72
|
-
version.Status = 'pending';
|
|
73
|
-
version.Type = 'lambda';
|
|
74
|
-
version.DefaultFile = 'index.html';
|
|
75
|
-
version.IntegrationID = 'abcd';
|
|
76
|
-
|
|
77
|
-
await version.Save(dbManager);
|
|
78
|
-
|
|
79
|
-
const version1 = await Version.LoadVersion({
|
|
80
|
-
dbManager,
|
|
81
|
-
key: {
|
|
82
|
-
AppName: 'Dog',
|
|
83
|
-
SemVer: '1.2.3-Beta5',
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
expect(version1.AppName).toBe('dog');
|
|
88
|
-
expect(version1.SK).toBe('version#1.2.3-beta5');
|
|
89
|
-
expect(version1.SemVer).toBe('1.2.3-Beta5');
|
|
90
|
-
|
|
91
|
-
const version2 = await Version.LoadVersion({
|
|
92
|
-
dbManager,
|
|
93
|
-
key: { AppName: 'Dog', SemVer: '1.2.3-Beta6' },
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
expect(version2.AppName).toBe('dog');
|
|
97
|
-
expect(version2.SK).toBe('version#1.2.3-beta6');
|
|
98
|
-
expect(version2.SemVer).toBe('1.2.3-Beta6');
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('load all app versions should load all versions for 1 app', async () => {
|
|
102
|
-
let version = new Version();
|
|
103
|
-
version.AppName = 'Frog';
|
|
104
|
-
version.SemVer = '2.2.3-Beta5';
|
|
105
|
-
version.Status = 'pending';
|
|
106
|
-
version.Type = 'lambda';
|
|
107
|
-
version.DefaultFile = 'index1.html';
|
|
108
|
-
version.IntegrationID = 'abcd1';
|
|
109
|
-
version.RouteIDAppVersion = 'routeAppVersion1';
|
|
110
|
-
version.RouteIDAppVersionSplat = 'routeAppVersionSplat1';
|
|
111
|
-
|
|
112
|
-
await version.Save(dbManager);
|
|
113
|
-
|
|
114
|
-
version = new Version();
|
|
115
|
-
version.AppName = 'Frog';
|
|
116
|
-
version.SemVer = '2.2.3-Beta6';
|
|
117
|
-
version.Status = 'pending';
|
|
118
|
-
version.Type = 'lambda';
|
|
119
|
-
version.DefaultFile = 'index2.html';
|
|
120
|
-
version.IntegrationID = 'abcd2';
|
|
121
|
-
version.RouteIDAppVersion = 'routeAppVersion2';
|
|
122
|
-
version.RouteIDAppVersionSplat = 'routeAppVersionSplat2';
|
|
123
|
-
|
|
124
|
-
await version.Save(dbManager);
|
|
125
|
-
|
|
126
|
-
const versions = await Version.LoadVersions({ dbManager, key: { AppName: 'Frog' } });
|
|
127
|
-
|
|
128
|
-
expect(versions.length).toBe(2);
|
|
129
|
-
|
|
130
|
-
expect(versions[0].AppName).toBe('frog');
|
|
131
|
-
expect(versions[0].SK).toBe('version#2.2.3-beta5');
|
|
132
|
-
expect(versions[0].SemVer).toBe('2.2.3-Beta5');
|
|
133
|
-
expect(versions[0].DefaultFile).toEqual('index1.html');
|
|
134
|
-
expect(versions[0].RouteIDAppVersion).toEqual('routeAppVersion1');
|
|
135
|
-
expect(versions[0].RouteIDAppVersionSplat).toEqual('routeAppVersionSplat1');
|
|
136
|
-
expect(versions[1].AppName).toBe('frog');
|
|
137
|
-
expect(versions[1].SK).toBe('version#2.2.3-beta6');
|
|
138
|
-
expect(versions[1].SemVer).toBe('2.2.3-Beta6');
|
|
139
|
-
expect(versions[1].DefaultFile).toEqual('index2.html');
|
|
140
|
-
expect(versions[1].RouteIDAppVersion).toEqual('routeAppVersion2');
|
|
141
|
-
expect(versions[1].RouteIDAppVersionSplat).toEqual('routeAppVersionSplat2');
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
describe('Type Lambda URL', () => {
|
|
146
|
-
it('saving and loading should return same record', async () => {
|
|
147
|
-
const version = new Version();
|
|
148
|
-
version.AppName = 'Cat';
|
|
149
|
-
version.SemVer = '1.2.3-Beta4';
|
|
150
|
-
version.Status = 'pending';
|
|
151
|
-
version.Type = 'lambda-url';
|
|
152
|
-
version.DefaultFile = 'index.html';
|
|
153
|
-
version.URL = 'https://abc123.lambda-url.us-east-1.on.aws/';
|
|
154
|
-
|
|
155
|
-
await version.Save(dbManager);
|
|
156
|
-
|
|
157
|
-
const { Item } = await dbManager.ddbDocClient.get({
|
|
158
|
-
TableName: dbManager.tableName,
|
|
159
|
-
Key: { PK: 'appname#cat', SK: 'version#1.2.3-beta4' },
|
|
160
|
-
});
|
|
161
|
-
expect(Item).toBeDefined();
|
|
162
|
-
expect(Item?.PK).toBe('appname#cat');
|
|
163
|
-
expect(Item?.SK).toBe('version#1.2.3-beta4');
|
|
164
|
-
expect(Item?.AppName).toBe('cat');
|
|
165
|
-
expect(Item?.SemVer).toBe('1.2.3-Beta4');
|
|
166
|
-
expect(Item?.Status).toBe('pending');
|
|
167
|
-
expect(Item?.Type).toBe('lambda-url');
|
|
168
|
-
expect(Item?.URL).toEqual('https://abc123.lambda-url.us-east-1.on.aws/');
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
});
|