aboutsummaryrefslogtreecommitdiffstats
path: root/docs/spec/writerSpec.js
blob: 973bb64e050b39ab9ed5034e464726580d4e7dbf (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
32
33
34
var writer = require('writer.js');
describe('writer', function() {
  describe('toString', function() {
    var toString = writer.toString;

    it('should merge string', function() {
      expect(toString('abc')).toEqual('abc');
    });

    it('should merge obj', function() {
      expect(toString({a:1})).toEqual('{"a":1}');
    });

    it('should merge array', function() {
      expect(toString(['abc',{}])).toEqual('abc{}');
    });
  });

  describe('replace method', function() {
    var content,
        replacements;

    beforeEach(function() {
      content = 'angular super jQuery manifest';
    });

    it('should replace placeholders', function() {
      replacements = {'angular': 'ng', 'jQuery': 'jqlite','notHere': 'here'};

      content = writer.replace(content, replacements);
      expect(content).toBe('ng super jqlite manifest');
    });
  });
});