Skip to content

Commit

Permalink
boost: exports all from apollo-angular and add tests (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkisiela authored Aug 21, 2018
1 parent 780228e commit 9284d9b
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 4 deletions.
6 changes: 5 additions & 1 deletion packages/apollo-angular-boost/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

### vNEXT

### v1.0.0-beta.2
### v1.0.0-beta.4

- Exports all from `apollo-angular`

### v1.0.0-beta.2, ### v1.0.0-beta.3

- Fixes an issue with initialization via `APOLLO_BOOST_CONFIG`

Expand Down
4 changes: 2 additions & 2 deletions packages/apollo-angular-boost/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"main": "build/bundles/ng.apolloBoost.umd.js",
"module": "build/fesm5/ng.apolloBoost.js",
"typings": "build/ng.apolloBoost.d.ts",
"version": "1.0.0-beta.3",
"version": "1.0.0-beta.4",
"repository": {
"type": "git",
"url": "apollographql/apollo-angular"
},
"scripts": {
"build": "ng-packagr -p ng-package.js",
"test": "yarn test-only",
"test-only": "yarn build",
"test-only": "jest --config jest.config.js",
"deploy": "yarn build && npm publish build"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-angular-boost/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import gql from 'graphql-tag';
export * from 'apollo-client';
export * from 'apollo-link';
export * from 'apollo-cache-inmemory';
export {Apollo, QueryRef} from 'apollo-angular';
export * from 'apollo-angular';
export {PresetConfig} from './types';
export {APOLLO_BOOST_CONFIG} from './tokens';
export {ApolloBoost} from './ApolloBoost';
Expand Down
20 changes: 20 additions & 0 deletions packages/apollo-angular-boost/tests/_setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'reflect-metadata';
import 'zone.js/dist/zone-node';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import 'jest-zone-patch';

import {getTestBed} from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';

export const setupAngular = () => {
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
);
};
35 changes: 35 additions & 0 deletions packages/apollo-angular-boost/tests/integration.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {setupAngular} from './_setup';

import {TestBed, inject} from '@angular/core/testing';
import {HttpClientModule} from '@angular/common/http';

import {Apollo, ApolloBoostModule, APOLLO_BOOST_CONFIG} from '../src';

describe('Integration', () => {
beforeAll(() => setupAngular());

describe('default', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientModule, ApolloBoostModule],
providers: [
{
provide: APOLLO_BOOST_CONFIG,
useValue: {
uri: '/graphql',
},
},
],
});
});

test('apollo should be initialzed', (done: jest.DoneCallback) => {
inject([Apollo], (apollo: Apollo) => {
expect(() => {
apollo.getClient();
}).not.toThrow();
done();
})();
});
});
});

0 comments on commit 9284d9b

Please sign in to comment.