Skip to content

Commit

Permalink
Merge pull request #242 from skedify/develop
Browse files Browse the repository at this point in the history
release/next
  • Loading branch information
DemianD committed May 6, 2021
2 parents 9a139c8 + 7417798 commit 3e9be2e
Show file tree
Hide file tree
Showing 8 changed files with 1,364 additions and 2,923 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 11.x, 14.x]
node-version: [10.x, 14.x, 16.x]

steps:
- uses: actions/checkout@v2
Expand All @@ -38,7 +38,7 @@ jobs:
run: npm run lint

- name: Test
run: npm run test
run: npm run check-coverage

- name: Build
run: npm run build
4,208 changes: 1,302 additions & 2,906 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,36 +43,36 @@
"semantic-release": "semantic-release"
},
"devDependencies": {
"@babel/preset-env": "^7.13.12",
"@commitlint/cli": "^12.0.1",
"@commitlint/config-conventional": "^12.0.1",
"@babel/preset-env": "^7.13.15",
"@commitlint/cli": "^12.1.1",
"@commitlint/config-conventional": "^12.1.1",
"@rollup/plugin-alias": "^3.1.2",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-inject": "^4.0.2",
"@rollup/plugin-node-resolve": "^11.2.0",
"@rollup/plugin-replace": "^2.4.1",
"@rollup/plugin-node-resolve": "^11.2.1",
"@rollup/plugin-replace": "^2.4.2",
"babel-eslint": "^10.1.0",
"babel-plugin-transform-polyfills": "^2.3.0",
"codecov": "^3.8.1",
"commitizen": "^4.2.3",
"core-js": "^3.9.1",
"core-js": "^3.11.1",
"cross-env": "^7.0.3",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.22.0",
"eslint-config-prettier": "^8.1.0",
"eslint": "^7.25.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-better": "^0.1.5",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-require-in-package": "^1.0.3",
"husky": "^4.3.8",
"jest": "^26.6.3",
"livereload": "^0.9.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.2.1",
"rimraf": "^3.0.2",
"rollup": "^2.42.3",
"rollup": "^2.45.2",
"rollup-plugin-terser": "^7.0.2",
"semantic-release": "^17.4.2",
"serve": "^11.3.2"
Expand Down
29 changes: 29 additions & 0 deletions src/Skedify.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,35 @@ describe('API', () => {
uninstallSkedifySDKMock(SDK2)
})

it('should call the onError callback even if the catch callback is undefined', async () => {
const mock = jest.fn()

SDK.configure({
onError: mock,
})

mockMatchingURLResponse(/subjects/, [], [], [], 500)
mockMatchingURLResponse(/subjects/, [], [], [], 500)
mockMatchingURLResponse(/subjects/, [], [], [], 500)

await SDK.subjects().then(undefined, undefined)

expect(mock).toHaveBeenCalled()
expect(mock.mock.calls[0]).toMatchSnapshot()
})

it('should not fail when the onError is not defined', async () => {
SDK.configure({
onError: undefined,
})

mockMatchingURLResponse(/subjects/, [], [], [], 500)
mockMatchingURLResponse(/subjects/, [], [], [], 500)
mockMatchingURLResponse(/subjects/, [], [], [], 500)

await SDK.subjects().then(undefined, undefined)
})

it('should convert all the `id` and `XXX_id` keys to strings', async () => {
mockResponse([
{ id: 1, foo: 'foo' },
Expand Down
16 changes: 16 additions & 0 deletions src/__snapshots__/Skedify.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,22 @@ Object {
}
`;

exports[`API should call the onError callback even if the catch callback is undefined 1`] = `
Array [
Object {
"data": Array [],
"errors": undefined,
"headers": undefined,
"meta": Array [],
"method": "get",
"query": undefined,
"status": 500,
"url": "https://api.example.com/subjects",
"warnings": Array [],
},
]
`;

exports[`API should call the onError callback of the configuration when there is an API error 1`] = `
Object {
"data": Array [],
Expand Down
4 changes: 2 additions & 2 deletions src/resources/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ Object {
"resource": "defined_availability",
"sub_resources": Object {},
},
"emailColors": Object {
"emailConfigs": Object {
"allowed_includes": Array [],
"allowed_methods": Array [
"*",
Expand All @@ -744,7 +744,7 @@ Object {
"filters": Array [],
"headers": Object {},
"requires_domain_map": false,
"resource": "email_colors",
"resource": "email_configs",
"sub_resources": Object {},
},
"emailPartials": Object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import createResourceDescription from './util/createResourceDescription'

export const emailColors = createResourceDescription('email_colors', {
export const emailConfigs = createResourceDescription('email_configs', {
enable_pagination: false,
enable_id_filter: false,
})
2 changes: 1 addition & 1 deletion src/resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export * from './contacts'
export * from './coverageRegions'
export * from './customers'
export * from './definedAvailability'
export * from './emailConfigs'
export * from './emailPartials'
export * from './emailTemplates'
export * from './emailColors'
export * from './employeeActivations'
export * from './employees'
export * from './enterprises'
Expand Down

0 comments on commit 3e9be2e

Please sign in to comment.