Skip to content

Commit acc18d6

Browse files
committed
add basic basic basic test
1 parent 9499a08 commit acc18d6

File tree

5 files changed

+986
-30
lines changed

5 files changed

+986
-30
lines changed

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"scripts": {
77
"build": "babel src -d lib",
88
"lint": "eslint src test",
9-
"prettier": "prettier --write \"{src,test}/**/*.js\""
9+
"prettier": "prettier --write \"{src,test}/**/*.js\"",
10+
"test": "jest test/"
1011
},
1112
"keywords": [],
1213
"author": "Nicolas Garnier",
@@ -26,6 +27,7 @@
2627
"eslint-config-airbnb-base": "^12.1.0",
2728
"eslint-config-prettier": "^2.6.0",
2829
"eslint-plugin-import": "^2.8.0",
30+
"jest": "^21.2.1",
2931
"prettier": "^1.7.4"
3032
}
3133
}

test/.eslintrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"globals": {
3+
"test": 0,
4+
"expect": 0,
5+
}
6+
}
File renamed without changes.

test/json2mjml.spec.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import fs from 'fs'
2+
import path from 'path'
3+
4+
import json2mjml from '../src/json2mjml'
5+
6+
const fakeJSON = fs.readFileSync(path.resolve(__dirname, 'fixtures', 'styleguide.json'))
7+
8+
test('converts JSON input to mjml', () => {
9+
const input = JSON.parse(fakeJSON)
10+
const result = json2mjml(input)
11+
expect(typeof result).toBe('string')
12+
expect(result.startsWith('<mjml>')).toBe(true)
13+
})

0 commit comments

Comments
 (0)