corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 var editorconfig = require('../');
2 var fs = require('fs');
3 var path = require('path');
4 var should = require('should');
5  
6 describe('parse', function() {
7 it('async', function() {
8 var expected = {
9 indent_style: 'space',
10 indent_size: 2,
11 end_of_line: 'lf',
12 charset: 'utf-8',
13 trim_trailing_whitespace: true,
14 insert_final_newline: true,
15 tab_width: 2
16 };
17 var target = path.join(__dirname, '/app.js');
18 var promise = editorconfig.parse(target);
19 return promise.then(function onFulfilled(result) {
20 expected.should.eql(result);
21 });
22 });
23  
24 it('sync', function() {
25 var expected = {
26 indent_style: 'space',
27 indent_size: 2,
28 end_of_line: 'lf',
29 charset: 'utf-8',
30 trim_trailing_whitespace: true,
31 insert_final_newline: true,
32 tab_width: 2
33 };
34 var target = path.join(__dirname, '/app.js');
35 expected.should.eql(editorconfig.parseSync(target));
36 });
37 });
38  
39 describe('parseFromFiles', function() {
40 it('async', function() {
41 var expected = {
42 indent_style: 'space',
43 indent_size: 2,
44 tab_width: 2,
45 end_of_line: 'lf',
46 charset: 'utf-8',
47 trim_trailing_whitespace: true,
48 insert_final_newline: true,
49 };
50 var configs = [];
51 var configPath = path.resolve(__dirname, '../.editorconfig');
52 var config = {
53 name: configPath,
54 contents: fs.readFileSync(configPath, 'utf8')
55 };
56 configs.push(config);
57 var target = path.join(__dirname, '/app.js');
58 var promise = editorconfig.parseFromFiles(target, configs);
59 return promise.then(function onFulfilled(result) {
60 expected.should.eql(result);
61 });
62 });
63  
64 it('sync', function() {
65 var expected = {
66 indent_style: 'space',
67 indent_size: 2,
68 tab_width: 2,
69 end_of_line: 'lf',
70 charset: 'utf-8',
71 trim_trailing_whitespace: true,
72 insert_final_newline: true,
73 };
74 var configs = [];
75 var configPath = path.resolve(__dirname, '../.editorconfig');
76 var config = {
77 name: configPath,
78 contents: fs.readFileSync(configPath, 'utf8')
79 };
80 configs.push(config);
81 var target = path.join(__dirname, '/app.js');
82 expected.should.eql(editorconfig.parseFromFilesSync(target, configs));
83 });
84 });