Created
July 10, 2018 15:23
-
-
Save DanielGallo/2f8ae7c311e6edc0cba4e2c44c5759e9 to your computer and use it in GitHub Desktop.
Read JSON file in Sencha Test
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
describe("Read JSON file", function() { | |
it("should read the data", function(done) { | |
var fs = require('fs'); | |
var users; | |
// Go up 2 folder paths in hierarchy | |
contextPath = contextPath.substring(0, contextPath.lastIndexOf('/')); | |
fs.readFile(contextPath + '/test.json', 'utf8', function (err, data) { | |
if (err) { | |
throw err; | |
} | |
users = JSON.parse(data); | |
expect(users[0].user.name).toBe('Dan'); | |
done(); | |
}); | |
}); | |
}); | |
// This is needed to obtain the current folder path of this test suite. This has to be placed here. | |
var contextPath = module.id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment