Skip to content

Commit

Permalink
Updates unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sgobotta committed Nov 17, 2019
1 parent 25268e7 commit a41d03b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/create-file.spec.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
import fs from 'fs'
import path from 'path'
import { expect } from 'chai'
import { createFile } from '../lib/create-file'
import exampleData from '../models/example.json'

describe('Create File', () => {
const fileName = 'example-test.json'
const outputDir = path.resolve(__dirname, `../../output/${fileName}`)
const outputPath = `output/${fileName}`

before('given a name \'example-test\' and a data object creates a json file with a model\'s data', () => {
createFile(fileName, exampleData)
createFile(outputPath, exampleData)
})

it('createFile - a json file with name \'example-test.json\' must exist', () => {
const filePath = outputDir
fs.exists(filePath, (exists) => {
const filePath = outputPath
fs.exists(`${process.cwd()}/${filePath}`, (exists) => {
expect(exists).to.eql(true)
})
})

after(() => {
const filePath = outputDir
const filePath = outputPath
fs.unlink(filePath, (error) => {
expect(error).to.eql(null)
})
Expand Down

0 comments on commit a41d03b

Please sign in to comment.