Skip to content

Commit 43c45d8

Browse files
committed
Stable Version 0.5.0
1 parent 996185b commit 43c45d8

File tree

3 files changed

+97
-2
lines changed

3 files changed

+97
-2
lines changed

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
##### 0.5.0 - 16 January 2014
2+
3+
###### Backwards API changes
4+
- #1 - Pluggable adapters
5+
- #6 - Observable objects
6+
- #7 - Model lifecycle hooks
7+
8+
###### Backwards compatible bug fixes
9+
- #19 - Null pointer exception in several places where angular-data tries to use the $q service
10+
11+
##### Other
12+
- #15 - Integration test coverage
13+
114
##### 0.4.2 - 15 January 2014
215

316
###### Backwards compatible bug fixes

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
__Data store for Angular.js.__
44

5-
__Current version:__ 0.4.2
5+
__Current version:__ 0.5.0
66

77
Angular-data is in a pre-1.0.0 development stage; the API is fluctuating, not a lot of tests yet, etc.
88

@@ -12,7 +12,7 @@ Pending:
1212
- Roadmap
1313
- Website / documentation
1414
- 100% tested (whatever _that_ means)
15-
- See [issues](https://github.com/jmdobry/angular-data/issues?milestone=8&page=1&state=open) for what's in development
15+
- See [issues](https://github.com/jmdobry/angular-data/issues?milestone=7&page=1&state=open) for what's in development
1616

1717
## Changelog
1818
[CHANGELOG.md](https://github.com/jmdobry/angular-data/blob/master/CHANGELOG.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
describe('DS.findAll(resourceName, params[, options]): ', function () {
2+
var errorPrefix = 'DS.findAll(resourceName, params[, options]): ';
3+
4+
it('should throw an error when method pre-conditions are not met', function (done) {
5+
DS.findAll('does not exist', {}).then(function () {
6+
fail('should have rejected');
7+
}, function (err) {
8+
assert.isTrue(err instanceof DS.errors.RuntimeError);
9+
assert.equal(err.message, errorPrefix + 'does not exist is not a registered resource!');
10+
});
11+
12+
angular.forEach(TYPES_EXCEPT_OBJECT, function (key) {
13+
DS.findAll('post', key).then(function () {
14+
fail('should have rejected');
15+
}, function (err) {
16+
assert.isTrue(err instanceof DS.errors.IllegalArgumentError);
17+
assert.equal(err.message, errorPrefix + 'params: Must be an object!');
18+
});
19+
});
20+
21+
angular.forEach(TYPES_EXCEPT_OBJECT, function (key) {
22+
if (key) {
23+
DS.findAll('post', {}, key).then(function () {
24+
fail('should have rejected');
25+
}, function (err) {
26+
assert.isTrue(err instanceof DS.errors.IllegalArgumentError);
27+
assert.equal(err.message, errorPrefix + 'options: Must be an object!');
28+
});
29+
}
30+
});
31+
32+
done();
33+
});
34+
it('should query the server for a collection', function (done) {
35+
$httpBackend.expectGET('http://test.angular-cache.com/posts?').respond(200, [p1, p2, p3, p4]);
36+
37+
DS.findAll('post', {}).then(function (data) {
38+
assert.deepEqual(data, [p1, p2, p3, p4]);
39+
}, function (err) {
40+
console.error(err.stack);
41+
fail('Should not have rejected!');
42+
});
43+
44+
assert.deepEqual(DS.filter('post', {}), [], 'The posts should not be in the store yet');
45+
46+
// Should have no effect because there is already a pending query
47+
DS.findAll('post', {}).then(function (data) {
48+
assert.deepEqual(data, [p1, p2, p3, p4]);
49+
}, function (err) {
50+
console.error(err.stack);
51+
fail('Should not have rejected!');
52+
});
53+
54+
$httpBackend.flush();
55+
56+
assert.deepEqual(DS.filter('post', {}), [p1, p2, p3, p4], 'The posts are now in the store');
57+
assert.isNumber(DS.lastModified('post', 5));
58+
assert.isNumber(DS.lastSaved('post', 5));
59+
60+
// Should not make a request because the request was already completed
61+
DS.findAll('post', {}).then(function (data) {
62+
assert.deepEqual(data, [p1, p2, p3, p4]);
63+
}, function (err) {
64+
console.error(err.stack);
65+
fail('Should not have rejected!');
66+
});
67+
68+
$httpBackend.expectGET('http://test.angular-cache.com/posts?').respond(200, [p1, p2, p3, p4]);
69+
70+
// Should make a request because bypassCache is set to true
71+
DS.findAll('post', {}, { bypassCache: true }).then(function (data) {
72+
assert.deepEqual(data, [p1, p2, p3, p4]);
73+
}, function (err) {
74+
console.error(err.stack);
75+
fail('Should not have rejected!');
76+
});
77+
78+
$httpBackend.flush();
79+
80+
done();
81+
});
82+
});

0 commit comments

Comments
 (0)