Skip to content

Commit

Permalink
Add tests for GA
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Nov 12, 2015
1 parent 22c23ad commit 101404a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions fixture/google-analytics/README.md
@@ -0,0 +1 @@
Hello.
6 changes: 6 additions & 0 deletions fixture/google-analytics/docpress.json
@@ -0,0 +1,6 @@
{
"googleAnalytics": {
"id": "UA-12345678-1",
"domain": "docpress.github.io"
}
}
9 changes: 9 additions & 0 deletions fixture/google-analytics/metalsmith.js
@@ -0,0 +1,9 @@
var app = require('docpress-core/ms')(__dirname)
.use(require('docpress-core')())
.use(require('../../')())

if (module.parent) {
module.exports = app
} else {
app.build(function (err) { if (err) throw err })
}
23 changes: 23 additions & 0 deletions test/fixture/google_analytics_test.js
@@ -0,0 +1,23 @@
'use strict'

const fixture = require('../support/fixture')
const buildMs = require('../support/build_ms')

describe('fixture/google-analytics:', function () {
let fx = fixture('google-analytics')
buildMs(fx.path('metalsmith.js'))

describe('index.html', function () {
before(function () {
this.data = fx.read('_docpress/index.html')
})

it('adds the GA isogram', function () {
expect(this.data).toInclude('function(d,o,c,p,r,e,s)')
})

it('adds the tracking ID', function () {
expect(this.data).toInclude('ga(\'create\',"UA-12345678-1",\'auto\')')
})
})
})

0 comments on commit 101404a

Please sign in to comment.