Skip to content

Commit

Permalink
add unit test files
Browse files Browse the repository at this point in the history
  • Loading branch information
crabbly committed Sep 23, 2018
1 parent 94b2862 commit 4627cb5
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/unit/browser.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Browser from '../../src/js/browser'

describe('Browser', () => {
it('has a function named isFirefox that returns a boolean value', () => {
expect(typeof Browser.isFirefox).toBe('function')
expect(typeof Browser.isFirefox()).toBe('boolean')
})

it('has a function named isIE that returns a boolean value', () => {
expect(typeof Browser.isIE).toBe('function')
expect(typeof Browser.isIE()).toBe('boolean')
})

it('has a function named isEdge that returns a boolean value', () => {
expect(typeof Browser.isEdge).toBe('function')
expect(typeof Browser.isEdge()).toBe('boolean')
})

it('has a function named isChrome that returns a boolean value', () => {
expect(typeof Browser.isChrome).toBe('function')
expect(typeof Browser.isChrome()).toBe('boolean')
})

it('has a function named isSafari that returns a boolean value', () => {
expect(typeof Browser.isSafari).toBe('function')
expect(typeof Browser.isSafari()).toBe('boolean')
})
})
17 changes: 17 additions & 0 deletions test/unit/functions.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { addWrapper, capitalizePrint } from '../../src/js/functions'

describe('addWrapper()', () => {
it('add a div wrapper to a raw html', () => {
const params = {
font: 'TimesNewRoman',
font_size: '12px'
}
expect(addWrapper('<span>Test</span>', params)).toBe('<div style="font-family:' + params.font + ' !important; font-size: ' + params.font_size + ' !important; width:100%;"><span>Test</span></div>')
})
})

describe('capitalizePrint()', () => {
it('should capitalize the first letter of a string', () => {
expect(capitalizePrint('test')).toBe('Test')
})
})
7 changes: 7 additions & 0 deletions test/unit/html.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Html from '../../src/js/html'

describe('Html', () => {
it('has a method named print', () => {
expect(typeof Html.print).toBe('function')
})
})
7 changes: 7 additions & 0 deletions test/unit/image.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Image from '../../src/js/image'

describe('Image', () => {
it('has a method named print', () => {
expect(typeof Image.print).toBe('function')
})
})
Empty file added test/unit/init.spec.js
Empty file.
7 changes: 7 additions & 0 deletions test/unit/json.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Json from '../../src/js/json'

describe('Json', () => {
it('has a method named print', () => {
expect(typeof Json.print).toBe('function')
})
})
11 changes: 11 additions & 0 deletions test/unit/modal.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Modal from '../../src/js/modal'

describe('Modal', () => {
it('has a method named show', () => {
expect(typeof Modal.show).toBe('function')
})

it('has a method named close', () => {
expect(typeof Modal.close).toBe('function')
})
})
7 changes: 7 additions & 0 deletions test/unit/pdf.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Pdf from '../../src/js/pdf'

describe('Pdf', () => {
it('has a method named print', () => {
expect(typeof Pdf.print).toBe('function')
})
})
7 changes: 7 additions & 0 deletions test/unit/print.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Print from '../../src/js/print'

describe('Print', () => {
it('has a method named send', () => {
expect(typeof Print.send).toBe('function')
})
})

0 comments on commit 4627cb5

Please sign in to comment.