summaryrefslogtreecommitdiff
path: root/node_modules/utile/test/file-test.js
blob: 99b22174574ff5a9994ffb888161132b63fe1238 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * file-test.js: Tests for `utile.file` module.
 *
 * (C) 2011, Charlie Robbins & the Contributors
 * MIT LICENSE
 *
 */

var assert = require('assert'),
    path = require('path'),
    vows = require('vows'),
    macros = require('./helpers/macros'),
    utile = require('../');

var fixture = path.join(__dirname, 'fixtures', 'read-json-file', 'config.json');

vows.describe('utile/file').addBatch({
  'When using utile': {
    'the `.file.readJson()` function': {
      topic: function () {
        utile.file.readJson(fixture, this.callback);
      },
      'should return correct JSON structure': macros.assertReadCorrectJson
    },
    'the `.file.readJsonSync()` function': {
      topic: utile.file.readJsonSync(fixture),
      'should return correct JSON structure': macros.assertReadCorrectJson
    }
  }
}).export(module);