Skip to content

Commit

Permalink
Merge pull request #139 from robsontenorio/dev
Browse files Browse the repository at this point in the history
Release v1.7.1
  • Loading branch information
JoaoPedroAS51 authored Nov 1, 2020
2 parents a740a17 + 2c67024 commit 0d803a2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
test:
name: Build & Test
name: Test

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -77,8 +77,8 @@ jobs:
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn install

- name: Test
run: yarn test
- name: Build
run: yarn build

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v1
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/api/query-builder-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ await Model.include('user', 'category')
Append attributes.

```js
await Model.include('likes')
await Model.append('likes')
```

## `select`
Expand Down
6 changes: 3 additions & 3 deletions src/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ export default class Model extends StaticModel {
let url = `${this.baseURL()}`;

args.forEach(object => {
if (object instanceof Model === false) {
if (!(object instanceof Model)) {
throw new Error('The object referenced on for() method is not a valid Model.')
}

if (!this.isValidId(object.getPrimaryKey())) {
throw new Error('The object referenced on for() method has a invalid id.')
throw new Error('The object referenced on for() method has an invalid id.')
}

url += `/${object.resource()}/${object.getPrimaryKey()}`
Expand All @@ -139,7 +139,7 @@ export default class Model extends StaticModel {
}

isValidId(id) {
return id !== undefined && id !== 0 && id !== '' && id !== null
return !!id
}

endpoint() {
Expand Down
2 changes: 1 addition & 1 deletion tests/model.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ describe('Model methods', () => {
const post = new Post({ text: 'Hello' }).for(user)
}

expect(errorModel).toThrow('The object referenced on for() method has a invalid id.')
expect(errorModel).toThrow('The object referenced on for() method has an invalid id.')
})

test('it throws a error when a custom() parameter is not a valid Model or a string', () => {
Expand Down

0 comments on commit 0d803a2

Please sign in to comment.