Sha256: 2ce52aa74fbc8935b2bfb0780a79719eb2fc0bc0d8d07f5c1f3824a688a59ad4
Contents?: true
Size: 1.01 KB
Versions: 7
Compression:
Stored size: 1.01 KB
Contents
describe('root wrapping', function () { 'use strict'; beforeEach(module('rails')); var q, rootScope, railsRootWrapper, Resource; beforeEach(inject(function ($rootScope, $q, railsResourceFactory, _railsRootWrapper_) { q = $q; rootScope = $rootScope; Resource = railsResourceFactory({name: 'test', pluralName: 'tests'}); railsRootWrapper = _railsRootWrapper_; })); it('should handle null root', function() { testTransform({test: null}, null); }); it('should transform arrays', function() { testTransform({tests: [1, 2, 3]}, [1, 2, 3]); }); it('should transform object', function() { testTransform({test: {abc: 'xyz', def: 'abc'}}, {abc: 'xyz', def: 'abc'}); }); function testTransform(wrappedData, unwrappedData) { expect(railsRootWrapper.wrap(unwrappedData, Resource)).toEqualData(wrappedData); expect(railsRootWrapper.unwrap({data: wrappedData}, Resource)).toEqualData({data: unwrappedData}); } });
Version data entries
7 entries across 7 versions & 1 rubygems