Files
streetmerchant/test/functional/test-notification.ts
T
Jef LeCompte f87053cb02 refactor: use gts instead of xo
feat: add browser opening to test:notification
feat: add c8 and mocha for testing
feat: update Docker and ci
style: update editorconfig
2021-01-17 15:21:53 -05:00

39 lines
717 B
TypeScript

import {Link, Store} from '../../src/store/model';
import open from 'open';
import {sendNotification} from '../../src/notification';
import {config} from '../../src/config';
const link: Link = {
brand: 'test:brand',
cartUrl: 'https://www.example.com/cartUrl',
model: 'test:model',
price: 100,
series: 'test:series',
url: 'https://www.example.com/url',
};
const store: Store = {
currency: '',
labels: {
inStock: {
container: 'test:container',
text: ['test:text'],
},
},
links: [link],
name: 'test:name',
};
/**
* Send test email.
*/
sendNotification(link, store);
/**
* Open browser.
*/
if (config.browser.open) {
open(link.cartUrl ?? link.url);
open(link.url);
}