1 | 'use strict';
|
2 |
|
3 | var assert = require('chai').assert,
|
4 | PATH = require('path'),
|
5 | QFS = require('q-io/fs'),
|
6 |
|
7 | LibNodes = require('..').require('./nodes/lib');
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | describe('nodes', function() {
|
21 |
|
22 | describe('new SymlinkLibraryNode()', function() {
|
23 |
|
24 | var node = new LibNodes.SymlinkLibraryNode({
|
25 | root: PATH.resolve(__dirname, 'data'),
|
26 | target: 'symlink',
|
27 | relative: 'lib'
|
28 | }),
|
29 | symlink = PATH.resolve(__dirname, 'data', 'symlink');
|
30 |
|
31 | describe('.getId()', function() {
|
32 | it('equals to target', function() {
|
33 | assert.equal(node.getId(), 'symlink');
|
34 | });
|
35 | });
|
36 |
|
37 | describe('.getPath()', function() {
|
38 | it('equals to absolute path to target', function() {
|
39 | assert.equal(node.getPath(), symlink);
|
40 | });
|
41 | });
|
42 |
|
43 | describe('.make()', function() {
|
44 |
|
45 | afterEach(function() {
|
46 | QFS.remove(symlink);
|
47 | });
|
48 |
|
49 | it('creates symlink', function(done) {
|
50 |
|
51 | node.make()
|
52 | .then(function() {
|
53 |
|
54 | return QFS.statLink(symlink)
|
55 | .then(function(stat) {
|
56 | assert.ok(stat.isSymbolicLink());
|
57 | done();
|
58 | })
|
59 | .fail(done);
|
60 |
|
61 | })
|
62 | .fail(done)
|
63 | .done();
|
64 |
|
65 | });
|
66 |
|
67 | });
|
68 |
|
69 | });
|
70 |
|
71 | });
|