forked from platanus/angular-restmod
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared-spec.js
More file actions
30 lines (22 loc) · 722 Bytes
/
Copy pathshared-spec.js
File metadata and controls
30 lines (22 loc) · 722 Bytes
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
'use strict';
describe('Plugin: Shared Model', function() {
var Bike;
beforeEach(module('restmod'));
beforeEach(inject(function(restmod) {
Bike = restmod.model('/api/bikes', 'SharedModel');
}));
it('should cache instances on $new and provide them on $new', function() {
var bike = Bike.$new(2);
var bike2 = Bike.$new(2);
var bike3 = Bike.$new(3);
var bike4 = Bike.$collection().$new(2);
expect(bike2).toBe(bike);
expect(bike3).not.toBe(bike);
expect(bike4).toBe(bike);
});
it('should cache instances on $decode and provide them on $new', function() {
var bike = Bike.$new().$decode({ id: 2 });
var bike2 = Bike.$new(2);
expect(bike2).toBe(bike);
});
});