backend-manager 5.9.6 → 5.9.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 +5 -3
- package/src/manager/events/cron/runner.js +0 -1
- package/src/manager/libraries/email/data/disposable-domains.json +21 -0
- package/src/test/fixtures/firebase-project/.temp/test-mode.json +1 -1
- package/src/test/fixtures/firebase-project/database-debug.log +8 -8
- package/src/test/fixtures/firebase-project/firestore-debug.log +55 -59
- package/src/test/fixtures/firebase-project/pubsub-debug.log +3 -3
- package/templates/_.env +42 -0
- package/templates/_.gitignore +60 -0
- package/templates/backend-manager-config.json +249 -0
- package/templates/database.rules.json +83 -0
- package/templates/firebase.json +66 -0
- package/templates/firestore.indexes.json +4 -0
- package/templates/firestore.rules +112 -0
- package/templates/public/404.html +26 -0
- package/templates/public/index.html +24 -0
- package/templates/remoteconfig.template.json +1 -0
- package/templates/storage-lifecycle-config-1-day.json +9 -0
- package/templates/storage-lifecycle-config-30-days.json +9 -0
- package/templates/storage.rules +8 -0
- package/test/_init/accounts-validation.js +58 -0
- package/test/_legacy/ai/index.js +231 -0
- package/test/_legacy/ai/test.jpg +0 -0
- package/test/_legacy/ai/test.pdf +0 -0
- package/test/_legacy/index.js +31 -0
- package/test/_legacy/payment-resolver/chargebee/orders/refunded.json +0 -0
- package/test/_legacy/payment-resolver/chargebee/orders/unpaid.json +98 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/active.json +578 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-in-trial.json +38 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-skipped-to-active.json +135 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-active-to-cancelled.json +42 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-active.json +44 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-cancelled.json +39 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-refund.json +143 -0
- package/test/_legacy/payment-resolver/chargebee/subscriptions/trial-to-suspended.json +48 -0
- package/test/_legacy/payment-resolver/coinbase/orders/regular.json +204 -0
- package/test/_legacy/payment-resolver/coinbase/subscriptions/cancelled.json +204 -0
- package/test/_legacy/payment-resolver/coinbase/subscriptions/paid-2.json +125 -0
- package/test/_legacy/payment-resolver/index.js +1558 -0
- package/test/_legacy/payment-resolver/paypal/orders/refunded.json +0 -0
- package/test/_legacy/payment-resolver/paypal/orders/regular.json +120 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/active-refund-previous-stmnt.json +323 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/active.json +192 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-in-trial.json +125 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-payment-not-complete.json +76 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-payment-overdue-2.json +114 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-payment-overdue.json +114 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-active-to-cancelled.json +111 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-active.json +132 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-cancelled.json +107 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-expired.json +91 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-refund.json +147 -0
- package/test/_legacy/payment-resolver/paypal/subscriptions/trial-to-suspended.json +120 -0
- package/test/_legacy/payment-resolver/stripe/orders/refunded.json +0 -0
- package/test/_legacy/payment-resolver/stripe/orders/regular.json +91 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/active.json +421 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/trial-in-trial.json +349 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-active-failed-authorization.json +430 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-active.json +319 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-cancelled.json +319 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-refund.json +414 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/trial-to-suspended.json +319 -0
- package/test/_legacy/payment-resolver/stripe/subscriptions/unsure.json +339 -0
- package/test/_legacy/test-new +1178 -0
- package/test/_legacy/test.md +89 -0
- package/test/_legacy/usage.js +175 -0
- package/test/_legacy/user.js +31 -0
- package/test/ai/tools-live.js +170 -0
- package/test/boot/emulator-boots.js +37 -0
- package/test/content/blog-generate.js +160 -0
- package/test/email/campaign-send.js +45 -0
- package/test/email/consent-lifecycle.js +257 -0
- package/test/email/feedback-and-plain-send.js +52 -0
- package/test/email/fixtures/clean.json +30 -0
- package/test/email/fixtures/editorial.json +30 -0
- package/test/email/fixtures/field-report.json +53 -0
- package/test/email/marketing-lifecycle.js +132 -0
- package/test/email/newsletter-generate.js +819 -0
- package/test/email/newsletter-templates.js +491 -0
- package/test/email/templates.js +207 -0
- package/test/email/transactional-send.js +34 -0
- package/test/email/transactional.js +560 -0
- package/test/email/validation.js +710 -0
- package/test/events/auth-delete-race.js +201 -0
- package/test/events/payments/journey-payments-cancel-endpoint.js +100 -0
- package/test/events/payments/journey-payments-cancel.js +182 -0
- package/test/events/payments/journey-payments-discount.js +89 -0
- package/test/events/payments/journey-payments-failure.js +146 -0
- package/test/events/payments/journey-payments-legacy-product.js +149 -0
- package/test/events/payments/journey-payments-one-time-failure.js +111 -0
- package/test/events/payments/journey-payments-one-time.js +136 -0
- package/test/events/payments/journey-payments-plan-change.js +144 -0
- package/test/events/payments/journey-payments-refund-webhook.js +180 -0
- package/test/events/payments/journey-payments-suspend.js +181 -0
- package/test/events/payments/journey-payments-trial-cancel.js +130 -0
- package/test/events/payments/journey-payments-trial.js +171 -0
- package/test/events/payments/journey-payments-uid-resolution.js +132 -0
- package/test/events/payments/journey-payments-upgrade.js +135 -0
- package/test/fixtures/chargebee/invoice-one-time.json +27 -0
- package/test/fixtures/chargebee/subscription-active.json +44 -0
- package/test/fixtures/chargebee/subscription-cancelled.json +42 -0
- package/test/fixtures/chargebee/subscription-in-trial.json +41 -0
- package/test/fixtures/chargebee/subscription-legacy-plan.json +41 -0
- package/test/fixtures/chargebee/subscription-non-renewing.json +41 -0
- package/test/fixtures/chargebee/subscription-paused.json +42 -0
- package/test/fixtures/chargebee/webhook-payment-failed.json +51 -0
- package/test/fixtures/chargebee/webhook-subscription-created.json +47 -0
- package/test/fixtures/paypal/order-approved.json +62 -0
- package/test/fixtures/paypal/order-completed.json +110 -0
- package/test/fixtures/paypal/subscription-active.json +76 -0
- package/test/fixtures/paypal/subscription-cancelled.json +50 -0
- package/test/fixtures/paypal/subscription-suspended.json +65 -0
- package/test/fixtures/stripe/checkout-session-completed.json +130 -0
- package/test/fixtures/stripe/invoice-payment-failed.json +148 -0
- package/test/fixtures/stripe/invoice-subscription-payment-failed.json +28 -0
- package/test/fixtures/stripe/subscription-active.json +161 -0
- package/test/fixtures/stripe/subscription-canceled.json +161 -0
- package/test/fixtures/stripe/subscription-trialing.json +161 -0
- package/test/functions/admin/database-read.js +134 -0
- package/test/functions/admin/database-write.js +159 -0
- package/test/functions/admin/edit-post.js +366 -0
- package/test/functions/admin/firestore-query.js +207 -0
- package/test/functions/admin/firestore-read.js +129 -0
- package/test/functions/admin/firestore-write.js +105 -0
- package/test/functions/admin/get-stats.js +115 -0
- package/test/functions/admin/send-email.js +119 -0
- package/test/functions/admin/send-notification.js +208 -0
- package/test/functions/admin/write-repo-content.js +223 -0
- package/test/functions/general/add-marketing-contact.js +335 -0
- package/test/functions/general/fetch-post.js +54 -0
- package/test/functions/general/generate-uuid.js +114 -0
- package/test/functions/test/authenticate.js +64 -0
- package/test/functions/user/create-custom-token.js +73 -0
- package/test/functions/user/delete.js +135 -0
- package/test/functions/user/get-active-sessions.js +111 -0
- package/test/functions/user/get-subscription-info.js +99 -0
- package/test/functions/user/regenerate-api-keys.js +156 -0
- package/test/functions/user/resolve.js +52 -0
- package/test/functions/user/sign-out-all-sessions.js +94 -0
- package/test/functions/user/sign-up.js +252 -0
- package/test/functions/user/submit-feedback.js +104 -0
- package/test/functions/user/validate-settings.js +82 -0
- package/test/helpers/ai-request-payload.js +300 -0
- package/test/helpers/ai-test-provider.js +202 -0
- package/test/helpers/ai-tools-format.js +383 -0
- package/test/helpers/content/blog-auto-publisher.js +484 -0
- package/test/helpers/content/feed-parser.js +528 -0
- package/test/helpers/content/ghostii-blocks.js +134 -0
- package/test/helpers/content/ghostii-feed-integration.js +404 -0
- package/test/helpers/content/ghostii-write-article.js +243 -0
- package/test/helpers/environment.js +230 -0
- package/test/helpers/infer-contact.js +113 -0
- package/test/helpers/merge-line-files.js +271 -0
- package/test/helpers/payment/chargebee/parse-webhook.js +413 -0
- package/test/helpers/payment/chargebee/to-unified-one-time.js +147 -0
- package/test/helpers/payment/chargebee/to-unified-subscription.js +648 -0
- package/test/helpers/payment/paypal/parse-webhook.js +539 -0
- package/test/helpers/payment/paypal/to-unified-one-time.js +382 -0
- package/test/helpers/payment/paypal/to-unified-subscription.js +820 -0
- package/test/helpers/payment/stripe/parse-webhook.js +447 -0
- package/test/helpers/payment/stripe/to-unified-one-time.js +306 -0
- package/test/helpers/payment/stripe/to-unified-subscription.js +708 -0
- package/test/helpers/sanitize.js +222 -0
- package/test/helpers/slugify.js +394 -0
- package/test/helpers/storage.js +194 -0
- package/test/helpers/user.js +755 -0
- package/test/helpers/webhook-forward.js +418 -0
- package/test/mcp/discovery.js +53 -0
- package/test/mcp/oauth.js +161 -0
- package/test/mcp/protocol.js +268 -0
- package/test/mcp/roles.js +188 -0
- package/test/mcp/utils.js +245 -0
- package/test/routes/admin/create-post.js +364 -0
- package/test/routes/admin/database.js +131 -0
- package/test/routes/admin/deduplicate-image-alts.js +190 -0
- package/test/routes/admin/email.js +114 -0
- package/test/routes/admin/firestore-query.js +204 -0
- package/test/routes/admin/firestore.js +127 -0
- package/test/routes/admin/infer-contact.js +218 -0
- package/test/routes/admin/notification.js +198 -0
- package/test/routes/admin/post-resize-image.js +184 -0
- package/test/routes/admin/post.js +368 -0
- package/test/routes/admin/repo-content.js +223 -0
- package/test/routes/admin/stats.js +112 -0
- package/test/routes/content/post.js +54 -0
- package/test/routes/general/uuid.js +115 -0
- package/test/routes/marketing/campaign.js +125 -0
- package/test/routes/marketing/contact.js +370 -0
- package/test/routes/marketing/email-preferences.js +292 -0
- package/test/routes/marketing/push-send.js +32 -0
- package/test/routes/marketing/webhook-forward.js +61 -0
- package/test/routes/marketing/webhook.js +639 -0
- package/test/routes/payments/cancel.js +163 -0
- package/test/routes/payments/discount.js +80 -0
- package/test/routes/payments/dispute-alert.js +320 -0
- package/test/routes/payments/intent.js +336 -0
- package/test/routes/payments/portal.js +92 -0
- package/test/routes/payments/refund.js +179 -0
- package/test/routes/payments/trial-eligibility.js +71 -0
- package/test/routes/payments/webhook.js +107 -0
- package/test/routes/test/authenticate.js +59 -0
- package/test/routes/test/schema.js +554 -0
- package/test/routes/test/usage.js +342 -0
- package/test/routes/user/api-keys.js +156 -0
- package/test/routes/user/delete.js +136 -0
- package/test/routes/user/feedback.js +104 -0
- package/test/routes/user/sessions.js +199 -0
- package/test/routes/user/settings-validate.js +82 -0
- package/test/routes/user/signup.js +542 -0
- package/test/routes/user/subscription.js +99 -0
- package/test/routes/user/token.js +73 -0
- package/test/routes/user/user.js +157 -0
- package/test/rules/notifications.js +410 -0
- package/test/rules/payments-carts.js +371 -0
- package/test/rules/user.js +396 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
const assert = require('assert');
|
|
2
|
+
const Manager = require('../../src/manager/index.js');
|
|
3
|
+
|
|
4
|
+
describe('AI Library Tests', function() {
|
|
5
|
+
let manager;
|
|
6
|
+
let assistant;
|
|
7
|
+
let ai;
|
|
8
|
+
|
|
9
|
+
before(function() {
|
|
10
|
+
manager = new Manager();
|
|
11
|
+
manager.init(exports, {
|
|
12
|
+
projectType: 'custom',
|
|
13
|
+
setupServer: false,
|
|
14
|
+
initialize: false,
|
|
15
|
+
backendManagerConfigPath: 'templates/backend-manager-config.json',
|
|
16
|
+
});
|
|
17
|
+
assistant = manager.assistant;
|
|
18
|
+
ai = new (require('../../src/manager/libraries/openai'))(assistant, process.env.OPENAI_API_KEY);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
if (!process.env.OPENAI_API_KEY) {
|
|
22
|
+
throw new Error('OPENAI_API_KEY is not set. Please set it in your environment variables.');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
describe('Simple AI Message Test', function() {
|
|
26
|
+
it('should respond with "Hi!" when asked to say hi', async function() {
|
|
27
|
+
this.timeout(30000);
|
|
28
|
+
|
|
29
|
+
const response = await ai.request({
|
|
30
|
+
// log: true,
|
|
31
|
+
prompt: { content: 'You are helping test an implementation. Please respond with "Hi!" and nothing else.' },
|
|
32
|
+
message: { content: 'Hi there friend!' },
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
assert(response);
|
|
36
|
+
assert(response.content);
|
|
37
|
+
assert.strictEqual(response.content.trim(), 'Hi!');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should analyze an image and respond with "cat"', async function() {
|
|
41
|
+
this.timeout(30000);
|
|
42
|
+
|
|
43
|
+
const response = await ai.request({
|
|
44
|
+
// log: true,
|
|
45
|
+
prompt: { content: 'You are a helpful assistant that describes images. Please answer in ONE WORD.' },
|
|
46
|
+
message: {
|
|
47
|
+
content: 'What animal is this?',
|
|
48
|
+
attachments: [
|
|
49
|
+
{
|
|
50
|
+
type: 'image',
|
|
51
|
+
content: `${__dirname}/test.jpg`,
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
assert(response);
|
|
58
|
+
assert(response.content);
|
|
59
|
+
assert.strictEqual(response.content.trim().toLowerCase(), 'cat');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('should analyze a PDF file and respond with "42"', async function() {
|
|
63
|
+
this.timeout(30000);
|
|
64
|
+
|
|
65
|
+
const response = await ai.request({
|
|
66
|
+
// log: true,
|
|
67
|
+
prompt: { content: 'You are a helpful assistant that analyzes documents. Please answer in ONE WORD.' },
|
|
68
|
+
message: {
|
|
69
|
+
content: 'What is the answer (numerical form)?',
|
|
70
|
+
attachments: [
|
|
71
|
+
{
|
|
72
|
+
type: 'file',
|
|
73
|
+
content: `${__dirname}/test.pdf`,
|
|
74
|
+
filename: 'test.pdf'
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
assert(response);
|
|
81
|
+
assert.strictEqual(response.content.trim().toLowerCase(), '42');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('should analyze a remote image URL and respond with "cat"', async function() {
|
|
85
|
+
this.timeout(30000);
|
|
86
|
+
|
|
87
|
+
const response = await ai.request({
|
|
88
|
+
// log: true,
|
|
89
|
+
prompt: { content: 'You are a helpful assistant that describes images. Please answer in ONE WORD.' },
|
|
90
|
+
message: {
|
|
91
|
+
content: 'What animal is this?',
|
|
92
|
+
attachments: [
|
|
93
|
+
{
|
|
94
|
+
type: 'image',
|
|
95
|
+
content: 'https://raw.githubusercontent.com/ITW-Creative-Works/backend-manager/master/test/ai/test.jpg',
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
assert(response);
|
|
102
|
+
assert(response.content);
|
|
103
|
+
assert.strictEqual(response.content.trim().toLowerCase(), 'cat');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('should analyze a remote PDF URL and respond with "42"', async function() {
|
|
107
|
+
this.timeout(30000);
|
|
108
|
+
|
|
109
|
+
const response = await ai.request({
|
|
110
|
+
// log: true,
|
|
111
|
+
prompt: { content: 'You are a helpful assistant that analyzes documents. Please answer in ONE WORD.' },
|
|
112
|
+
message: {
|
|
113
|
+
content: 'What is the answer (numerical form)?',
|
|
114
|
+
attachments: [
|
|
115
|
+
{
|
|
116
|
+
type: 'file',
|
|
117
|
+
content: 'https://raw.githubusercontent.com/ITW-Creative-Works/backend-manager/master/test/ai/test.pdf',
|
|
118
|
+
filename: 'test.pdf'
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
assert(response);
|
|
125
|
+
assert.strictEqual(response.content.trim().toLowerCase(), '42');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('should return JSON when response format is set to json', async function() {
|
|
129
|
+
this.timeout(30000);
|
|
130
|
+
|
|
131
|
+
const response = await ai.request({
|
|
132
|
+
// log: true,
|
|
133
|
+
response: 'json',
|
|
134
|
+
prompt: { content: 'You are a helpful assistant that returns structured data in JSON format.' },
|
|
135
|
+
message: { content: 'Give me information about a cat in JSON format with fields: name, age, color.' },
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
assert(response);
|
|
139
|
+
assert(response.content);
|
|
140
|
+
assert(typeof response.content === 'object');
|
|
141
|
+
assert(response.content.name);
|
|
142
|
+
assert(response.content.age);
|
|
143
|
+
assert(response.content.color);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('should return data matching schema when schema is provided', async function() {
|
|
147
|
+
this.timeout(30000);
|
|
148
|
+
|
|
149
|
+
const schema = {
|
|
150
|
+
type: 'object',
|
|
151
|
+
properties: {
|
|
152
|
+
animal: {
|
|
153
|
+
type: 'string',
|
|
154
|
+
description: 'The type of animal'
|
|
155
|
+
},
|
|
156
|
+
characteristics: {
|
|
157
|
+
type: 'array',
|
|
158
|
+
items: {
|
|
159
|
+
type: 'string'
|
|
160
|
+
},
|
|
161
|
+
description: 'List of characteristics'
|
|
162
|
+
},
|
|
163
|
+
habitat: {
|
|
164
|
+
type: 'string',
|
|
165
|
+
description: 'Where the animal lives'
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
required: ['animal', 'characteristics', 'habitat'],
|
|
169
|
+
additionalProperties: false
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const response = await ai.request({
|
|
173
|
+
// log: true,
|
|
174
|
+
response: 'json',
|
|
175
|
+
schema: schema,
|
|
176
|
+
prompt: { content: 'You are a helpful assistant that provides animal information.' },
|
|
177
|
+
message: { content: 'Tell me about a lion.' },
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
assert(response);
|
|
181
|
+
assert(response.content);
|
|
182
|
+
assert(typeof response.content === 'object');
|
|
183
|
+
assert.strictEqual(typeof response.content.animal, 'string');
|
|
184
|
+
assert(Array.isArray(response.content.characteristics));
|
|
185
|
+
assert.strictEqual(typeof response.content.habitat, 'string');
|
|
186
|
+
assert(response.content.animal.toLowerCase().includes('lion'));
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('should moderate content and return moderation results', async function() {
|
|
190
|
+
this.timeout(30000);
|
|
191
|
+
|
|
192
|
+
const response = await ai.request({
|
|
193
|
+
// log: true,
|
|
194
|
+
moderate: true,
|
|
195
|
+
prompt: { content: 'You are a helpful assistant.' },
|
|
196
|
+
message: { content: 'This is a completely normal and appropriate message about cats.' },
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
assert(response);
|
|
200
|
+
assert(response.content);
|
|
201
|
+
assert(response.moderation);
|
|
202
|
+
assert(typeof response.moderation.flagged === 'boolean');
|
|
203
|
+
assert.strictEqual(response.moderation.flagged, false);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it('should moderate content with image attachment', async function() {
|
|
207
|
+
this.timeout(30000);
|
|
208
|
+
|
|
209
|
+
const response = await ai.request({
|
|
210
|
+
// log: true,
|
|
211
|
+
moderate: true,
|
|
212
|
+
prompt: { content: 'You are a helpful assistant.' },
|
|
213
|
+
message: {
|
|
214
|
+
content: 'Here is an image of a cat.',
|
|
215
|
+
attachments: [
|
|
216
|
+
{
|
|
217
|
+
type: 'image',
|
|
218
|
+
content: `${__dirname}/test.jpg`,
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
assert(response);
|
|
225
|
+
assert(response.content);
|
|
226
|
+
assert(response.moderation);
|
|
227
|
+
assert(typeof response.moderation.flagged === 'boolean');
|
|
228
|
+
assert.strictEqual(response.moderation.flagged, false);
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
});
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const package = require('../package.json');
|
|
2
|
+
const assert = require('assert');
|
|
3
|
+
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
before(() => {
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
after(() => {
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* ============
|
|
15
|
+
* Test Cases
|
|
16
|
+
* ============
|
|
17
|
+
*/
|
|
18
|
+
describe(`${package.name}`, () => {
|
|
19
|
+
describe('.dependencies()', () => {
|
|
20
|
+
Object.keys(package.dependencies).forEach((dependency) => {
|
|
21
|
+
it(`should load ${dependency}`, () => {
|
|
22
|
+
try {
|
|
23
|
+
const dep = require(dependency);
|
|
24
|
+
assert.ok(dep);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
assert.fail(`Failed to load ${dependency}: ${e.message}`);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
})
|
|
File without changes
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "3065",
|
|
3
|
+
"customer_id": "1mbDWfyRLtX1eX1WGs",
|
|
4
|
+
"recurring": false,
|
|
5
|
+
"status": "payment_due",
|
|
6
|
+
"price_type": "tax_exclusive",
|
|
7
|
+
"date": 1682588083,
|
|
8
|
+
"due_date": 1682588083,
|
|
9
|
+
"net_term_days": 0,
|
|
10
|
+
"exchange_rate": 1,
|
|
11
|
+
"total": 100,
|
|
12
|
+
"amount_paid": 0,
|
|
13
|
+
"amount_adjusted": 0,
|
|
14
|
+
"write_off_amount": 0,
|
|
15
|
+
"credits_applied": 0,
|
|
16
|
+
"amount_due": 100,
|
|
17
|
+
"dunning_status": "in_progress",
|
|
18
|
+
"next_retry_at": 1682674483,
|
|
19
|
+
"updated_at": 1682588084,
|
|
20
|
+
"resource_version": 1682588084806,
|
|
21
|
+
"deleted": false,
|
|
22
|
+
"object": "invoice",
|
|
23
|
+
"first_invoice": false,
|
|
24
|
+
"amount_to_collect": 100,
|
|
25
|
+
"round_off_amount": 0,
|
|
26
|
+
"has_advance_charges": false,
|
|
27
|
+
"currency_code": "USD",
|
|
28
|
+
"base_currency_code": "USD",
|
|
29
|
+
"generated_at": 1682588083,
|
|
30
|
+
"is_gifted": false,
|
|
31
|
+
"term_finalized": true,
|
|
32
|
+
"channel": "web",
|
|
33
|
+
"tax": 0,
|
|
34
|
+
"line_items": [{
|
|
35
|
+
"id": "li_169nryTccS7iu5mem",
|
|
36
|
+
"date_from": 1682588083,
|
|
37
|
+
"date_to": 1682588083,
|
|
38
|
+
"unit_amount": 1,
|
|
39
|
+
"quantity": 100,
|
|
40
|
+
"amount": 100,
|
|
41
|
+
"pricing_model": "per_unit",
|
|
42
|
+
"is_taxed": false,
|
|
43
|
+
"tax_amount": 0,
|
|
44
|
+
"object": "line_item",
|
|
45
|
+
"customer_id": "1mbDWfyRLtX1eX1WGs",
|
|
46
|
+
"description": "Total",
|
|
47
|
+
"entity_type": "addon",
|
|
48
|
+
"entity_id": "one-time-unit-1",
|
|
49
|
+
"tax_exempt_reason": "tax_not_configured",
|
|
50
|
+
"discount_amount": 0,
|
|
51
|
+
"item_level_discount_amount": 0
|
|
52
|
+
}],
|
|
53
|
+
"sub_total": 100,
|
|
54
|
+
"linked_payments": [{
|
|
55
|
+
"txn_id": "txn_169nryTccS7kM5men",
|
|
56
|
+
"applied_amount": 100,
|
|
57
|
+
"applied_at": 1682588084,
|
|
58
|
+
"txn_status": "failure",
|
|
59
|
+
"txn_date": 1682588083,
|
|
60
|
+
"txn_amount": 100
|
|
61
|
+
}],
|
|
62
|
+
"applied_credits": [],
|
|
63
|
+
"adjustment_credit_notes": [],
|
|
64
|
+
"issued_credit_notes": [],
|
|
65
|
+
"linked_orders": [],
|
|
66
|
+
"dunning_attempts": [{
|
|
67
|
+
"created_at": 1682588084,
|
|
68
|
+
"attempt": 0,
|
|
69
|
+
"dunning_type": "auto_collect",
|
|
70
|
+
"transaction_id": "txn_169nryTccS7kM5men",
|
|
71
|
+
"txn_status": "failure",
|
|
72
|
+
"txn_amount": 100
|
|
73
|
+
}],
|
|
74
|
+
"billing_address": {
|
|
75
|
+
"first_name": "Test",
|
|
76
|
+
"last_name": "Lastname",
|
|
77
|
+
"line1": "1234 Main Street",
|
|
78
|
+
"city": "Los Angeles",
|
|
79
|
+
"state_code": "CA",
|
|
80
|
+
"state": "California",
|
|
81
|
+
"country": "US",
|
|
82
|
+
"zip": "90000",
|
|
83
|
+
"validation_status": "not_validated",
|
|
84
|
+
"object": "billing_address"
|
|
85
|
+
},
|
|
86
|
+
"shipping_address": {
|
|
87
|
+
"first_name": "Test",
|
|
88
|
+
"last_name": "Lastname",
|
|
89
|
+
"line1": "1234 Main Street",
|
|
90
|
+
"city": "Los Angeles",
|
|
91
|
+
"state_code": "CA",
|
|
92
|
+
"state": "California",
|
|
93
|
+
"country": "US",
|
|
94
|
+
"zip": "90000",
|
|
95
|
+
"validation_status": "not_validated",
|
|
96
|
+
"object": "shipping_address"
|
|
97
|
+
}
|
|
98
|
+
}
|