backend-manager 5.0.124 → 5.0.126
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 +1 -1
- package/test/_legacy/usage.js +5 -0
- package/test/helpers/user.js +11 -10
package/package.json
CHANGED
package/test/_legacy/usage.js
CHANGED
|
@@ -55,6 +55,7 @@ describe(`${package.name}`, () => {
|
|
|
55
55
|
requests: {
|
|
56
56
|
total: 0,
|
|
57
57
|
monthly: 0,
|
|
58
|
+
daily: 0,
|
|
58
59
|
last: {
|
|
59
60
|
id: '',
|
|
60
61
|
timestamp: '1970-01-01T00:00:00.000Z',
|
|
@@ -73,6 +74,7 @@ describe(`${package.name}`, () => {
|
|
|
73
74
|
requests: {
|
|
74
75
|
total: 1,
|
|
75
76
|
monthly: 1,
|
|
77
|
+
daily: 1,
|
|
76
78
|
last: {
|
|
77
79
|
id: 'increment',
|
|
78
80
|
timestamp: '2024-01-01T01:00:00.000Z',
|
|
@@ -91,6 +93,7 @@ describe(`${package.name}`, () => {
|
|
|
91
93
|
requests: {
|
|
92
94
|
total: -1,
|
|
93
95
|
monthly: -1,
|
|
96
|
+
daily: -1,
|
|
94
97
|
last: {
|
|
95
98
|
id: 'decrement',
|
|
96
99
|
timestamp: '2024-01-01T01:00:00.000Z',
|
|
@@ -133,6 +136,7 @@ describe(`${package.name}`, () => {
|
|
|
133
136
|
requests: {
|
|
134
137
|
total: 1,
|
|
135
138
|
monthly: 1,
|
|
139
|
+
daily: 1,
|
|
136
140
|
last: {
|
|
137
141
|
id: 'update',
|
|
138
142
|
timestamp: '2024-01-01T01:00:00.000Z',
|
|
@@ -155,6 +159,7 @@ describe(`${package.name}`, () => {
|
|
|
155
159
|
signups: {
|
|
156
160
|
total: 1,
|
|
157
161
|
monthly: 1,
|
|
162
|
+
daily: 1,
|
|
158
163
|
last: {
|
|
159
164
|
id: 'singups',
|
|
160
165
|
timestamp: '2024-01-01T01:00:00.000Z',
|
package/test/helpers/user.js
CHANGED
|
@@ -72,7 +72,8 @@ module.exports = {
|
|
|
72
72
|
assert.ok(user.api.privateKey.length > 0, 'api.privateKey should not be empty');
|
|
73
73
|
|
|
74
74
|
// Usage
|
|
75
|
-
assert.equal(user.usage.requests.
|
|
75
|
+
assert.equal(user.usage.requests.monthly, 0, 'usage.requests.monthly should be 0');
|
|
76
|
+
assert.equal(user.usage.requests.daily, 0, 'usage.requests.daily should be 0');
|
|
76
77
|
assert.equal(user.usage.requests.total, 0, 'usage.requests.total should be 0');
|
|
77
78
|
assert.equal(user.usage.requests.last.id, null, 'usage.requests.last.id should be null');
|
|
78
79
|
|
|
@@ -204,24 +205,24 @@ module.exports = {
|
|
|
204
205
|
async run({ assert }) {
|
|
205
206
|
const user = createUser({
|
|
206
207
|
usage: {
|
|
207
|
-
requests: {
|
|
208
|
-
emails: {
|
|
209
|
-
sends: {
|
|
208
|
+
requests: { monthly: 10, total: 100, last: { id: 'r1', timestamp: '2025-01-01T00:00:00.000Z', timestampUNIX: 1735689600 } },
|
|
209
|
+
emails: { monthly: 5, total: 50, last: { id: 'e1', timestamp: '2025-01-02T00:00:00.000Z', timestampUNIX: 1735776000 } },
|
|
210
|
+
sends: { monthly: 3, total: 30 },
|
|
210
211
|
},
|
|
211
212
|
});
|
|
212
213
|
|
|
213
214
|
// Defined key (requests)
|
|
214
|
-
assert.equal(user.usage.requests.
|
|
215
|
+
assert.equal(user.usage.requests.monthly, 10, 'requests.monthly preserved');
|
|
215
216
|
assert.equal(user.usage.requests.total, 100, 'requests.total preserved');
|
|
216
217
|
assert.equal(user.usage.requests.last.id, 'r1', 'requests.last.id preserved');
|
|
217
218
|
|
|
218
219
|
// Dynamic key (emails) — full data
|
|
219
|
-
assert.equal(user.usage.emails.
|
|
220
|
+
assert.equal(user.usage.emails.monthly, 5, 'emails.monthly preserved');
|
|
220
221
|
assert.equal(user.usage.emails.total, 50, 'emails.total preserved');
|
|
221
222
|
assert.equal(user.usage.emails.last.id, 'e1', 'emails.last.id preserved');
|
|
222
223
|
|
|
223
224
|
// Dynamic key (sends) — partial data, template fills in missing
|
|
224
|
-
assert.equal(user.usage.sends.
|
|
225
|
+
assert.equal(user.usage.sends.monthly, 3, 'sends.monthly preserved');
|
|
225
226
|
assert.equal(user.usage.sends.total, 30, 'sends.total preserved');
|
|
226
227
|
assert.equal(user.usage.sends.last.id, null, 'sends.last.id defaulted to null');
|
|
227
228
|
assert.ok(user.usage.sends.last.timestamp, 'sends.last.timestamp defaulted');
|
|
@@ -484,8 +485,8 @@ module.exports = {
|
|
|
484
485
|
},
|
|
485
486
|
},
|
|
486
487
|
usage: {
|
|
487
|
-
requests: {
|
|
488
|
-
emails: {
|
|
488
|
+
requests: { monthly: 100, total: 5000, last: { id: 'req-z', timestamp: '2025-12-01T00:00:00.000Z', timestampUNIX: 1764633600 } },
|
|
489
|
+
emails: { monthly: 42, total: 2100, last: { id: 'em-z', timestamp: '2025-12-01T00:00:00.000Z', timestampUNIX: 1764633600 } },
|
|
489
490
|
},
|
|
490
491
|
personal: {
|
|
491
492
|
name: { first: 'Ian', last: 'Wiedenman' },
|
|
@@ -508,7 +509,7 @@ module.exports = {
|
|
|
508
509
|
assert.equal(user.api.clientId, 'uuid-123', 'api clientId preserved');
|
|
509
510
|
assert.equal(user.oauth2.google.token.access_token, 'ya29.real', 'oauth2 token preserved');
|
|
510
511
|
assert.equal(user.oauth2.google.identity.email, 'ian@gmail.com', 'oauth2 identity preserved');
|
|
511
|
-
assert.equal(user.usage.emails.
|
|
512
|
+
assert.equal(user.usage.emails.monthly, 42, 'usage emails preserved');
|
|
512
513
|
assert.equal(user.personal.name.first, 'Ian', 'name preserved');
|
|
513
514
|
assert.equal(user.personal.company.name, 'ITW Creative Works', 'company preserved');
|
|
514
515
|
assert.equal(user.personal.birthday.timestampUNIX, 642988800, 'birthday preserved');
|