Skip to content

Commit 58bb4ac

Browse files
committed
test: update test server with generic template
1 parent 7edcc99 commit 58bb4ac

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

test/data/message.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"title": "Olá",
3+
"subtitle": "Subtítulo",
4+
"body": "Texto <b>bold</b>",
5+
"button_text": "Comprar",
6+
"button_link": "https://www.ecomplus.io/"
7+
}

test/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ <h3>Transactional email templates for E-Com Plus stores</h3>
2121
<li><a href="/abandoned-cart">abandoned-cart</code></a></li>
2222
<li><a href="/authorized">authorized</code></a></li>
2323
<li><a href="/delivered">delivered</code></a></li>
24+
<li><a href="/generic">generic</code></a></li>
2425
<li><a href="/in_dispute">in_dispute</code></a></li>
2526
<li><a href="/in_production">in_production</code></a></li>
2627
<li><a href="/in_separation">in_separation</code></a></li>

test/server.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const {
2727
receivedForExchange,
2828
returned,
2929
stock,
30-
new_order
30+
new_order,
31+
generic,
3132
} = require('./../src/')
3233

3334
// sample JSON data
@@ -36,6 +37,7 @@ const customer = require('./data/customer.json')
3637
const cart = require('./data/cart.json')
3738
const order = require('./data/order.json')
3839
const product = require('./data/product.json')
40+
const message = require('./data/message.json')
3941

4042
// setup dev server with BrowserSync
4143
const browserSync = require('browser-sync').create()
@@ -251,6 +253,14 @@ browserSync.init({
251253
.catch(err => console.error(err))
252254
}
253255
},
256+
{
257+
route: '/generic',
258+
handle (req, res, next) {
259+
generic(store, message, 'pt_br')
260+
.then(html => res.end(html))
261+
.catch(err => console.error(err))
262+
}
263+
},
254264
],
255265

256266
// watch template source files and reload local server

0 commit comments

Comments
 (0)