Skip to content

Instantly share code, notes, and snippets.

@aadennis
Created July 28, 2018 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aadennis/ebccd59d02dfc89d1a8d78e0504b11ef to your computer and use it in GitHub Desktop.
Save aadennis/ebccd59d02dfc89d1a8d78e0504b11ef to your computer and use it in GitHub Desktop.
// Hack test to prove we can return and check the contents of a file
var assert = require('assert')
var path = require('path')
var fs = require('fs')
describe('flashcard metadata checks', function () {
// arrange, act
var musicalNotesMetaData //scope
before(function (done) {
var fullPath = __dirname + '/MusicalNotes/TestArtifacts'
var musicalNotesMetaDataFile = fullPath + '/MusicalNotes.json'
fs.readFile(musicalNotesMetaDataFile, 'utf8', function (err, data) {
if (err) throw err;
musicalNotesMetaData = JSON.parse(data);
done() // NOTE THE LOCATION OF done(): It is in the readFile callback, not at the end of before or beforeEach
});
});
// assert
it('has the correct values for selected elements', function () {
assert.equal(musicalNotesMetaData.musicalNotes.extension, '.png')
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment