This repository has been archived by the owner on Jan 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from lookback/feature/tests
- [x] Adds package tests for `Mailer`. Just to check for existence of `Mailer` object for now. - [x] Sets up `example` app for testing in app testing mode. Checks if an email renders with data. - [x] Use ES6 modules. - [x] Runs tests on CircleCI. - [x] Updates example (and now also test app) to Meteor 1.4.2.
- Loading branch information
Showing
23 changed files
with
254 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
PORT=3100 | ||
TEST_DRIVER=dispatch:mocha | ||
|
||
lint: | ||
@./node_modules/.bin/eslint . | ||
|
||
test-package: | ||
@meteor test-packages ./ --driver-package $(TEST_DRIVER) --once --port $(PORT) | ||
|
||
test-app: | ||
@cd example && npm test -- --port $(PORT) && cd - | ||
|
||
test-app-watch: | ||
@cd example && npm run test:watch -- --port $(PORT) | ||
|
||
test-watch: | ||
@TEST_WATCH=1 meteor test-packages ./ --driver-package $(TEST_DRIVER) --port $(PORT) | ||
|
||
.PHONY: test, test-watch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
machine: | ||
node: | ||
version: 5.8.0 | ||
|
||
dependencies: | ||
cache_directories: | ||
- "~/.meteor" | ||
- "~/.npm" | ||
override: | ||
# -- CACHE METEOR -- | ||
# Restore the meteor symlink | ||
- if [ -d ~/.meteor ]; then sudo ln -s ~/.meteor/meteor /usr/local/bin/meteor; fi | ||
# Install Meteor (if not restored from cache) | ||
- if [ ! -e ~/.meteor/meteor ]; then curl https://install.meteor.com | /bin/sh; fi | ||
- npm install --no-progress | ||
- meteor npm install --no-progress: | ||
pwd: example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,18 @@ | |
# 'meteor add' and 'meteor remove' will edit this file for you, | ||
# but you can also edit it by hand. | ||
|
||
ecmascript | ||
ecmascript@0.5.9 | ||
lookback:emails | ||
#chrisbutler:[email protected] | ||
meteor-base | ||
meteor-base@1.0.4 | ||
blaze-html-templates | ||
reload | ||
reload@1.1.11 | ||
spacebars | ||
kadira:flow-router | ||
#iron:router | ||
standard-minifier-css | ||
standard-minifier-js | ||
[email protected] | ||
[email protected] | ||
|
||
practicalmeteor:chai | ||
dispatch:mocha | ||
shell-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[email protected].1.1 | ||
[email protected].2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
Templates = {}; | ||
export default { | ||
sample: { | ||
path: 'sample-email/template.html', // Relative to the 'private' dir. | ||
scss: 'sample-email/style.scss', // Mail specific SCSS. | ||
|
||
Templates.sample = { | ||
path: 'sample-email/template.html', // Relative to the 'private' dir. | ||
scss: 'sample-email/style.scss', // Mail specific SCSS. | ||
helpers: { | ||
capitalizedName() { | ||
return this.name.charAt(0).toUpperCase() + this.name.slice(1); | ||
} | ||
}, | ||
|
||
helpers: { | ||
capitalizedName() { | ||
return this.name.charAt(0).toUpperCase() + this.name.slice(1); | ||
} | ||
}, | ||
|
||
route: { | ||
path: '/sample/:name', | ||
data: function(params) { | ||
return { | ||
route: { | ||
path: '/sample/:name', | ||
data: (params) => ({ | ||
name: params.name, | ||
names: ['Johan', 'John', 'Paul', 'Ringo'] | ||
}; | ||
}) | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* eslint-env mocha */ | ||
import { Mailer } from 'meteor/lookback:emails'; | ||
import { assert } from 'meteor/practicalmeteor:chai'; | ||
|
||
describe('Render email', () => { | ||
|
||
it('should render an email', () => { | ||
const string = Mailer.render('sample', { | ||
name: 'johan', | ||
names: ['Johan', 'John', 'Paul', 'Ringo'] | ||
}); | ||
|
||
assert.isString(string); | ||
assert.match(string, new RegExp('<h2>Hi Johan', 'gm'), 'includes heading with capitalized name'); | ||
}); | ||
|
||
it('should render with a layout', () => { | ||
const searchFor = 'Paul is dead'; | ||
|
||
const string = Mailer.render('sample', { | ||
name: 'johan', | ||
names: ['Johan', 'John', 'Paul', 'Ringo'], | ||
preview: searchFor | ||
}); | ||
|
||
assert.isString(string); | ||
assert.match(string, new RegExp(`<title>${searchFor}</title>`, 'gm'), 'includes a <title> element from layout.html'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Mailer as theModule } from './lib/mailer'; | ||
|
||
Mailer = theModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.