Skip to content

Commit 2cacd73

Browse files
committed
feat(test): changing test server variables and index
1 parent ddedebf commit 2cacd73

File tree

3 files changed

+191
-14
lines changed

3 files changed

+191
-14
lines changed

test/data/order.json

+17-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,23 @@
155155
}
156156
],
157157
"own_hand": false,
158-
"receipt": false
158+
"receipt": false,
159+
"invoices": [
160+
{
161+
"issuer": {
162+
"doc_number":"777888999",
163+
"inscription_type": "state",
164+
"inscription_number": "798456asdads",
165+
"corporate_name": "loja demo LTDA EIRELI"
166+
},
167+
"number": "984131invoicenumber",
168+
"serial_number": "Serial89645312",
169+
"issued_at": "2019-07-02T20:06:02.971Z",
170+
"link": "https://nfe.prefeitura.sp.gov.br/contribuinte/notaprint.aspx?ccm=10691090&nf=39850&cod=NQXGX2DC",
171+
"access_key": "877878a",
172+
"link_danfe": "http://nfe-static.dafiti.com.br/nfe/31190911200418000673550010183981031379451765.pdf"
173+
}
174+
]
159175
}
160176
],
161177
"shipping_method_label": "EXPRESSO",

test/index.html

+26
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,32 @@ <h3>Transactional email templates for E-Com Plus stores</h3>
1616
such as <code><a href="/welcome">/welcome</code></a> to render
1717
<code>/views/welcome.ejs</code> and <code>/scss/welcome.scss</code>.
1818
</p>
19+
<p class="lead">Default mails:</p>
20+
<ul>
21+
<li><a href="/abandoned-cart">abandoned-cart</code></a></li>
22+
<li><a href="/authorized">authorized</code></a></li>
23+
<li><a href="/delivered">delivered</code></a></li>
24+
<li><a href="/in_dispute">in_dispute</code></a></li>
25+
<li><a href="/in_production">in_production</code></a></li>
26+
<li><a href="/in_separation">in_separation</code></a></li>
27+
<li><a href="/invoice_issued">invoice_issued</code></a></li>
28+
<li><a href="/paid">paid</code></a></li>
29+
<li><a href="/partially_delivered">partially_delivered</code></a></li>
30+
<li><a href="/partially_paid">partially_paid</code></a></li>
31+
<li><a href="/partially_refunded">partially_refunded</code></a></li>
32+
<li><a href="/partially_shipped">partially_shipped</code></a></li>
33+
<li><a href="/pending">pending</code></a></li>
34+
<li><a href="/ready_for_shipping">ready_for_shipping</code></a></li>
35+
<li><a href="/received_for_exchange">received_for_exchange</code></a></li>
36+
<li><a href="/refunded">refunded</code></a></li>
37+
<li><a href="/returned_for_exchange">returned_for_exchange</code></a></li>
38+
<li><a href="/returned">returned</code></a></li>
39+
<li><a href="/shipped">shipped</code></a></li>
40+
<li><a href="/unauthorized">unauthorized</code></a></li>
41+
<li><a href="/under_analysis">under_analysis</code></a></li>
42+
<li><a href="/voided">voided</code></a></li>
43+
<li><a href="/welcome">welcome</code></a></li>
44+
</ul>
1945
</div>
2046
</body>
2147
</html>

test/server.js

+148-13
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,28 @@
33
// load the lib object
44
const {
55
welcome,
6-
newOrder,
6+
pending,
77
abandonedCart,
88
delivered,
9-
payment,
9+
authorized,
1010
shipped,
11-
denied,
12-
canceled
11+
unauthorized,
12+
voided,
13+
underAnalysis,
14+
partiallyPaid,
15+
paid,
16+
inDispute,
17+
partiallyRefunded,
18+
refunded,
19+
invoice_issued,
20+
inProduction,
21+
inSeparation,
22+
readyForShipping,
23+
partiallyShipped,
24+
partiallyDelivered,
25+
returnedForExchange,
26+
receivedForExchange,
27+
returned
1328
} = require('./../src/')
1429

1530
// sample JSON data
@@ -41,9 +56,9 @@ browserSync.init({
4156
}
4257
},
4358
{
44-
route: '/new-order',
59+
route: '/pending',
4560
handle (req, res, next) {
46-
newOrder(store, customer, order, 'pt_br')
61+
pending(store, customer, order, 'pt_br')
4762
.then(html => res.end(html))
4863
.catch(err => console.error(err))
4964
}
@@ -57,9 +72,9 @@ browserSync.init({
5772
}
5873
},
5974
{
60-
route: '/payment',
75+
route: '/authorized',
6176
handle (req, res, next) {
62-
payment(store, customer, order, 'pt_br')
77+
authorized(store, customer, order, 'pt_br')
6378
.then(html => res.end(html))
6479
.catch(err => console.error(err))
6580
}
@@ -73,21 +88,141 @@ browserSync.init({
7388
}
7489
},
7590
{
76-
route: '/denied',
91+
route: '/unauthorized',
7792
handle (req, res, next) {
78-
denied(store, customer, order, 'pt_br')
93+
unauthorized(store, customer, order, 'pt_br')
7994
.then(html => res.end(html))
8095
.catch(err => console.error(err))
8196
}
8297
},
8398
{
84-
route: '/canceled',
99+
route: '/voided',
85100
handle (req, res, next) {
86-
canceled(store, customer, order, 'pt_br')
101+
voided(store, customer, order, 'pt_br')
87102
.then(html => res.end(html))
88103
.catch(err => console.error(err))
89104
}
90-
}
105+
},
106+
{
107+
route: '/under_analysis',
108+
handle (req, res, next) {
109+
underAnalysis(store, customer, order, 'pt_br')
110+
.then(html => res.end(html))
111+
.catch(err => console.error(err))
112+
}
113+
},
114+
{
115+
route: '/partially_paid',
116+
handle (req, res, next) {
117+
partiallyPaid(store, customer, order, 'pt_br')
118+
.then(html => res.end(html))
119+
.catch(err => console.error(err))
120+
}
121+
},
122+
{
123+
route: '/paid',
124+
handle (req, res, next) {
125+
paid(store, customer, order, 'pt_br')
126+
.then(html => res.end(html))
127+
.catch(err => console.error(err))
128+
}
129+
},
130+
{
131+
route: '/in_dispute',
132+
handle (req, res, next) {
133+
inDispute(store, customer, order, 'pt_br')
134+
.then(html => res.end(html))
135+
.catch(err => console.error(err))
136+
}
137+
},
138+
{
139+
route: '/partially_refunded',
140+
handle (req, res, next) {
141+
partiallyRefunded(store, customer, order, 'pt_br')
142+
.then(html => res.end(html))
143+
.catch(err => console.error(err))
144+
}
145+
},
146+
{
147+
route: '/refunded',
148+
handle (req, res, next) {
149+
refunded(store, customer, order, 'pt_br')
150+
.then(html => res.end(html))
151+
.catch(err => console.error(err))
152+
}
153+
},
154+
{
155+
route: '/invoice_issued',
156+
handle (req, res, next) {
157+
invoice_issued(store, customer, order, 'pt_br')
158+
.then(html => res.end(html))
159+
.catch(err => console.error(err))
160+
}
161+
},
162+
{
163+
route: '/in_production',
164+
handle (req, res, next) {
165+
inProduction(store, customer, order, 'pt_br')
166+
.then(html => res.end(html))
167+
.catch(err => console.error(err))
168+
}
169+
},
170+
{
171+
route: '/in_separation',
172+
handle (req, res, next) {
173+
inSeparation(store, customer, order, 'pt_br')
174+
.then(html => res.end(html))
175+
.catch(err => console.error(err))
176+
}
177+
},
178+
{
179+
route: '/ready_for_shipping',
180+
handle (req, res, next) {
181+
readyForShipping(store, customer, order, 'pt_br')
182+
.then(html => res.end(html))
183+
.catch(err => console.error(err))
184+
}
185+
},
186+
{
187+
route: '/partially_shipped',
188+
handle (req, res, next) {
189+
partiallyShipped(store, customer, order, 'pt_br')
190+
.then(html => res.end(html))
191+
.catch(err => console.error(err))
192+
}
193+
},
194+
{
195+
route: '/partially_delivered',
196+
handle (req, res, next) {
197+
partiallyDelivered(store, customer, order, 'pt_br')
198+
.then(html => res.end(html))
199+
.catch(err => console.error(err))
200+
}
201+
},
202+
{
203+
route: '/returned_for_exchange',
204+
handle (req, res, next) {
205+
returnedForExchange(store, customer, order, 'pt_br')
206+
.then(html => res.end(html))
207+
.catch(err => console.error(err))
208+
}
209+
},
210+
{
211+
route: '/received_for_exchange',
212+
handle (req, res, next) {
213+
receivedForExchange(store, customer, order, 'pt_br')
214+
.then(html => res.end(html))
215+
.catch(err => console.error(err))
216+
}
217+
},
218+
{
219+
route: '/returned',
220+
handle (req, res, next) {
221+
returned(store, customer, order, 'pt_br')
222+
.then(html => res.end(html))
223+
.catch(err => console.error(err))
224+
}
225+
},
91226
],
92227

93228
// watch template source files and reload local server

0 commit comments

Comments
 (0)