UNPKG

1.55 kBJavaScriptView Raw
1var assert = require('assert'),
2 path = require('path'),
3 errors = require('../lib/errors');
4
5describe('binary errors', function() {
6
7 function getCurrentPlatform() {
8 if (process.platform === 'win32') {
9 return 'Windows';
10 } else if (process.platform === 'darwin') {
11 return 'OS X';
12 }
13 return '';
14 }
15
16 function getCurrentArchitecture() {
17 if (process.arch === 'x86' || process.arch === 'ia32') {
18 return '32-bit';
19 } else if (process.arch === 'x64') {
20 return '64-bit';
21 }
22 return '';
23 }
24
25 function getCurrentEnvironment() {
26 return getCurrentPlatform() + ' ' + getCurrentArchitecture();
27 }
28
29 describe('for an unsupported environment', function() {
30 it('identifies the current environment', function() {
31 var message = errors.unsupportedEnvironment();
32 assert.ok(message.indexOf(getCurrentEnvironment()) !== -1);
33 });
34
35 it('links to supported environment documentation', function() {
36 var message = errors.unsupportedEnvironment();
37 assert.ok(message.indexOf('https://github.com/sass/node-sass/releases/tag/v') !== -1);
38 });
39 });
40
41 describe('for an missing binary', function() {
42 it('identifies the current environment', function() {
43 var message = errors.missingBinary();
44 assert.ok(message.indexOf(getCurrentEnvironment()) !== -1);
45 });
46
47 it('documents the expected binary location', function() {
48 var message = errors.missingBinary();
49 assert.ok(message.indexOf(path.sep + 'vendor' + path.sep) !== -1);
50 });
51 });
52
53});