Skip to content

Commit 5bc6379

Browse files
author
Cédric Delpoux
committed
Add tests
1 parent 41f3a17 commit 5bc6379

6 files changed

Lines changed: 75 additions & 19 deletions

File tree

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"prettier"
1414
],
1515
"globals": {
16+
"document": true,
1617
"window": true
1718
}
1819
}

CHANGELOG.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
1+
# 4.0.1 - 2017-10-26
2+
* Addeded: Tests
3+
14
# 4.0.0 - 2017-10-25
2-
* Update : Tranform Hight Order Component to React Component using a render prop
3-
* Add : CommonJS build
4-
* Add : ES6 build
5-
* Add : UMD build
6-
* Add : Demo page
5+
* Updated: Tranform Hight Order Component to React Component using a render prop
6+
* Added: CommonJS build
7+
* Added: ES6 build
8+
* Added: UMD build
9+
* Added: Demo page
710

811
# 3.0.1 - 2017-07-03
9-
* Update : Documentation
12+
* Updated: Documentation
1013

1114
# 3.0.0 - 2017-07-03
12-
* Update : Deprecate v2.0.3
15+
* Updated: Deprecate v2.0.3
1316

1417
# 2.0.3 - 2017-06-14
15-
* Update : Render component even when google maps is not loaded yet
18+
* Updated: Render component even when google maps is not loaded yet
1619

1720
# 2.0.2 - 2017-01-04
18-
* Update : React peer dependency
21+
* Updated: React peer dependency
1922

2023
# 2.0.1 - 2016-11-21
21-
* Add : Handle non web-browser environments
24+
* Added: Handle non web-browser environments
2225

2326
# 2.0.0 - 2016-10-24
2427

25-
* Add : `little-loader` lib to fetch Google Map API
26-
* Add : `query-string` lib to transform params to query string
27-
* Update : `package.json` : description, author, dependencies
28-
* Update : `.babelrc`
29-
* Update : `.eslintrc`
30-
* Update : `src/index.js`
28+
* Added: `little-loader` lib to fetch Google Map API
29+
* Added: `query-string` lib to transform params to query string
30+
* Updated: `package.json` description, author and dependencies
31+
* Updated: `.babelrc`
32+
* Updated: `.eslintrc`
33+
* Updated: `src/index.js`
3134

3235
# 1.0.1 - 2015-09-11
3336

34-
* Add : libraryTarget into Webpack config
37+
* Added: libraryTarget into Webpack config
3538

3639

3740
# 1.0.0 - 2015-09-08

jest.transform.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// eslint-disable-next-line
22
module.exports = require("babel-jest").createTransformer({
3-
presets: ["es2015", "react"],
3+
presets: ["env", "react"],
44
plugins: ["transform-object-rest-spread"],
55
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-google-maps-loader",
3-
"version": "4.0.0",
3+
"version": "4.0.1",
44
"author": {
55
"name": "Cédric Delpoux",
66
"email": "xuopled@gmail.com"

src/index.test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {mount} from "enzyme"
2+
import React from "react"
3+
import GoogleMapsLoader from "./index"
4+
5+
const html = "Loaded"
6+
const params = {
7+
key: "AIzaSyCI3cDduwloUnVSfREo-6wuRYTMjOHcQjc",
8+
}
9+
10+
const GoogleMapsLoaderFixture = (
11+
<GoogleMapsLoader
12+
params={params}
13+
render={googleMaps => googleMaps && <div>{html}</div>}
14+
/>
15+
)
16+
17+
beforeAll(() => {
18+
const script = document.createElement("script")
19+
document.body.appendChild(script)
20+
})
21+
22+
describe("GoogleMapsLoader", () => {
23+
it("renders", () => {
24+
mount(GoogleMapsLoaderFixture)
25+
})
26+
})
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import loadGoogleMapsSdk from "./index"
2+
const params = {
3+
key: "AIzaSyCI3cDduwloUnVSfREo-6wuRYTMjOHcQjc",
4+
libraries: "places,geometry",
5+
}
6+
7+
beforeAll(() => {
8+
const script = document.createElement("script")
9+
document.body.appendChild(script)
10+
})
11+
12+
describe("loadGoogleMapsSdk", () => {
13+
test("Loads places and geometry libraries", done => {
14+
function callback(googleMaps) {
15+
expect(googleMaps).toEqual(
16+
expect.objectContaining({
17+
places: expect.anything(),
18+
geometry: expect.anything(),
19+
})
20+
)
21+
done()
22+
}
23+
24+
loadGoogleMapsSdk(params, callback)
25+
})
26+
})

0 commit comments

Comments
 (0)