diff options
| author | Pete Bacon Darwin | 2013-06-25 21:17:36 +0100 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-06-25 21:17:36 +0100 |
| commit | 73f811203200ec96b7a396151327089c39fe37a3 (patch) | |
| tree | 0202126d4b5a4fad0eba3194c07b847dbf11aba4 /docs/spec/writerSpec.js | |
| parent | 71bc1b761d9721805caab9479287b34169c0121e (diff) | |
| download | angular.js-73f811203200ec96b7a396151327089c39fe37a3.tar.bz2 | |
fix(doc-gen): correctly transform index files
Closes #3021
Diffstat (limited to 'docs/spec/writerSpec.js')
| -rw-r--r-- | docs/spec/writerSpec.js | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/docs/spec/writerSpec.js b/docs/spec/writerSpec.js index c0f80de3..1c25078c 100644 --- a/docs/spec/writerSpec.js +++ b/docs/spec/writerSpec.js @@ -1,7 +1,26 @@ -var writer = require('../src/writer.js'); +var writer, + rewire = require('rewire'); + +function mockResolvedPromise(resolvedValue) { + return { + then: function(success, failure) { + success(resolvedValue); + } + }; +} + describe('writer', function() { + + beforeEach(function() { + writer = rewire('../src/writer.js'); + }); + describe('toString', function() { - var toString = writer.toString; + var toString; + + beforeEach(function() { + toString = writer.toString; + }); it('should merge string', function() { expect(toString('abc')).toEqual('abc'); @@ -31,4 +50,15 @@ describe('writer', function() { expect(content).toBe('ng super jqlite manifest'); }); }); + + describe('copy', function() { + it('should call the transformation function', function() { + var readMock = jasmine.createSpy('readMock').andReturn(mockResolvedPromise('DUMMY CONTENT')); + writer.__set__("qfs.read", readMock); + var transformationFn = jasmine.createSpy('transformationFn'); + writer.copy('from', 'to', transformationFn, 'arg1', 'arg2'); + expect(readMock).toHaveBeenCalled(); + expect(transformationFn).toHaveBeenCalledWith('DUMMY CONTENT', 'arg1', 'arg2'); + }); + }); }); |
