Skip to content

Commit

Permalink
Update version
Browse files Browse the repository at this point in the history
  • Loading branch information
ardalanamini committed Jan 7, 2019
1 parent 1d93fa1 commit 12763a2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

---

## [next](https://github.com/foxifyjs/odin/releases/tag/next) - *(2019-__-__)*
## [v0.9.0](https://github.com/foxifyjs/odin/releases/tag/v0.9.0) - *(2019-01-07)*

- :zap: Added `iterate` method to `DB`, `Odin` & relational methods
- :zap: Added `unset` method to `DB`
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@foxify/odin",
"version": "0.8.0",
"version": "0.9.0",
"description": "Active Record Model",
"author": "Ardalan Amini <[email protected]> [https://github.com/ardalanamini]",
"contributors": [
Expand Down Expand Up @@ -63,7 +63,7 @@
"@foxify/schema": "^1.0.1",
"@types/async": "^2.0.50",
"@types/deasync": "^0.1.0",
"@types/jest": "^23.3.11",
"@types/jest": "^23.3.12",
"codecov": "^3.1.0",
"dotenv": "^6.2.0",
"fs-readdir-recursive": "^1.1.0",
Expand Down
22 changes: 22 additions & 0 deletions test/relations/HasMany.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,25 @@ test("Model.has [deep]", async () => {

expect(results).toEqual(items);
});

test("Model.whereHas [deep]", async () => {
expect.assertions(1);

const items = USERS
.filter(user =>
array.any(MESSAGES, message =>
CHATS
.filter(chat => chat.username === user.username)
.findIndex(chat => message.chatname === chat.name &&
MESSAGES.findIndex(message => chat.name === message.chatname
&& /5/.test(message.message)) !== -1) !== -1
)
);

const results = await User
.whereHas("chats.messages", q => q.whereLike("message", "5"))
.lean()
.get();

expect(results).toEqual(items);
});

0 comments on commit 12763a2

Please sign in to comment.