forked from alinemorelli/react-gtm
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
alinemorelliw
committed
Jun 18, 2017
1 parent
41ce016
commit b11bfac
Showing
7 changed files
with
111 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
node_modules | ||
node_modules | ||
__tests__ | ||
coverage |
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,2 +1,3 @@ | ||
node_modules | ||
*.log | ||
*.log | ||
coverage |
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,22 @@ | ||
import Snippets from '../Snippets' | ||
|
||
let args | ||
let snippets | ||
|
||
describe('Snippets', () => { | ||
beforeEach(() => { | ||
args = { id: 'GTM-abc123', dataLayerName: 'dataLayer', additionalEvents: {} } | ||
snippets = Snippets(args) | ||
}) | ||
|
||
it('should use the `id` for the iframe', () => { | ||
expect(snippets.iframe).toContain('id=GTM-abc123', 1) | ||
}) | ||
|
||
it('no id provided should log a warn', () => { | ||
console.warn = jest.fn() | ||
const noIdArgs = { dataLayerName: 'dataLayer', additionalEvents: {} } | ||
Snippets(noIdArgs) | ||
expect(console.warn).toBeCalled() | ||
}) | ||
}) |
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,20 @@ | ||
import React from 'react' | ||
import { mount } from 'enzyme' | ||
import TagManager from '../TagManager' | ||
|
||
describe('TagManager', () => { | ||
it('should render tagmanager', () => { | ||
const wrapper = mount( | ||
<TagManager gtmId='GTM-abc123' /> | ||
) | ||
expect(wrapper.find('noscript')).toHaveLength(1) | ||
}) | ||
|
||
it('should render datalayer', () => { | ||
const dataLayer = {} | ||
const wrapper = mount( | ||
<TagManager gtmId='GTM-abc123' dataLayer={dataLayer} /> | ||
) | ||
expect(wrapper.find('noscript')).toHaveLength(1) | ||
}) | ||
}) |
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,11 @@ | ||
import sinon from 'sinon' | ||
import warn from '../utils/warn' | ||
|
||
describe('warn()', function () { | ||
it('should append [react-gtm] to warning messages', () => { | ||
sinon.stub(console, 'warn') | ||
// // console.warn.toHaveBeenCalled() | ||
warn('foo') | ||
console.warn.toHaveBeenCalled | ||
}) | ||
}) |
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