Skip to content

Commit

Permalink
Merge pull request #1 from lathonez/master
Browse files Browse the repository at this point in the history
Synching from orig
  • Loading branch information
hfwittmann authored Apr 28, 2017
2 parents 7b400e7 + 6268157 commit 123f1b1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<a name="2.13.0"></a>
# 2.13.0 (2017-04-25)

### Features

* **Unit**: Improve test coverage [#243](https://github.com/lathonez/clicker/pull/243) ([3e2551f](https://github.com/lathonez/clicker/commit/3e2551f))

<a name="2.12.1"></a>
# 2.12.1 (2017-04-20)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"test-coverage": "ng test --code-coverage",
"test-ci": "ng test --watch=false --code-coverage"
},
"version": "2.12.1",
"version": "2.13.0",
"dependencies": {
"@angular/common": "4.0.0",
"@angular/compiler": "4.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/pages/page2/page2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe('Pages: Page2', () => {
fixture = TestBed.createComponent(Page2);
instance = fixture;
fixture.detectChanges();
fixture.componentInstance.onGainChange();
});
}));

Expand Down
8 changes: 8 additions & 0 deletions src/services/clickers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ describe('ClickersService', () => {
expect(clickedClicker.getCount()).toEqual(1);
});

it('loads empty list if given no argument', (done: Function) => {
clickers['initIds'](false)
.then((ids: Array<string>) => {
expect(ids).toEqual([]);
done();
});
});

it('loads IDs from storage', (done: Function) => {
clickers['initIds']()
.then((ids: Array<string>) => {
Expand Down
4 changes: 2 additions & 2 deletions src/services/clickers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export class ClickersService {
}

// initialise Ids from SQL storage
private initIds(): Promise<{}> {
private initIds(load = true): Promise<{}> {
return this.storage.get('ids') // return the promise so we can chain initClickers
.then((rawIds: string) => {
if (!rawIds) return [];
if (!rawIds || !load) return [];
// ids are stored as stringified JSON array
return JSON.parse(rawIds);
});
Expand Down
1 change: 0 additions & 1 deletion src/services/storage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ let storage: StorageService = null;
describe('StorageService', () => {

beforeEach(() => {
spyOn(StorageService, 'initStorage').and.returnValue(new StorageMock());
storage = new StorageService();
spyOn(storage['storage'], 'get').and.callThrough();
spyOn(storage['storage'], 'set').and.callThrough();
Expand Down

0 comments on commit 123f1b1

Please sign in to comment.