-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: storeName can be used in createInstance and instance functions. #119
base: master
Are you sure you want to change the base?
Changes from 2 commits
82856dc
0503e19
4576554
7995159
4421f21
706dd61
197d7e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,6 +150,18 @@ describe('Module: LocalForageModule', function() { | |
}, done); | ||
}); | ||
|
||
it('should have an iterationNumber with a 1-index', function(done) { | ||
var count; | ||
|
||
$localForage.iterate(function(value, key, iterationNumber) { | ||
count = iterationNumber; | ||
}).then(function() { | ||
stopDigests(interval); | ||
expect(count).toEqual(3); | ||
done(); | ||
}, done); | ||
}) | ||
|
||
it('key/value filter should work', function(done) { | ||
//test key filter | ||
$localForage.iterate(function(value, key) { | ||
|
@@ -465,4 +477,50 @@ describe('Module: LocalForageModule', function() { | |
}, done); | ||
}); | ||
}); | ||
|
||
describe("instance", function () { | ||
var testInstance_1; | ||
var testInstance_2; | ||
it('should create new instance for a storeName', function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some of these cases are really tests for beforeEach(function () {
testInstance_1 = $localForage.createInstance({
name: 'testName',
storeName: 'TEST_INSTANCE_1'
});
testInstance_2 = $localForage.createInstance({
name: 'testName',
storeName: 'TEST_INSTANCE_2'
});
});
it('retrieve the instance by name and storeName', function () {
expect($localForage.instance({
name: 'testName',
storeName: 'TEST_INSTANCE_1'
})).toBe(jasmine.any(LocalForageInstance));
}); |
||
testInstance_1 = $localForage.createInstance({ | ||
storeName: 'TEST_INSTANCE_1' | ||
}); | ||
}); | ||
it('should create new instance for another storeName in same name', function () { | ||
testInstance_2 = $localForage.createInstance({ | ||
storeName: 'TEST_INSTANCE_2' | ||
}); | ||
}); | ||
it('should give error if user tries to create new instance with already created storeName', function () { | ||
var instance = $localForage.createInstance({ | ||
storeName: 'TEST_INSTANCE_3' | ||
}); | ||
expect(function () { | ||
var duplicateInstance = $localForage.createInstance({ | ||
storeName: 'TEST_INSTANCE_3' | ||
}); | ||
}).toThrowError(); | ||
}); | ||
it('should get created instance', function () { | ||
$localForage.createInstance({ | ||
name: 'testName', | ||
storeName: 'TEST_INSTANCE_4' | ||
}); | ||
var instance = $localForage.instance({ | ||
name: 'testName', | ||
storeName: 'TEST_INSTANCE_4' | ||
}); | ||
}); | ||
it('should not get non-created instance', function () { | ||
expect(function () { | ||
$localForage.instance({storeName: 'TEST_INSTANCE_4'}); | ||
}).toThrowError('No localForage instance of that name exists.'); | ||
expect(function () { | ||
$localForage.instance({ | ||
name: 'wrongTestName', | ||
storeName: 'TEST_INSTANCE_4' | ||
}); | ||
}).toThrowError('No localForage instance of that name exists.'); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of this added code is indented 4 spaces, but the rest of the code base is 2-space indent. Please conform, to keep a consistent style.