-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
task(core): fix tests, patch joigoose [#56]
- Loading branch information
Showing
37 changed files
with
4,112 additions
and
6,188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
diff --git a/node_modules/joigoose/lib/index.js b/node_modules/joigoose/lib/index.js | ||
index 9bc235f..20fc9b8 100644 | ||
--- a/node_modules/joigoose/lib/index.js | ||
+++ b/node_modules/joigoose/lib/index.js | ||
@@ -142,6 +142,10 @@ internals.typeDeterminer = joiObject => { | ||
return Boolean; | ||
} | ||
|
||
+ if (joiObject._type === "objectId") { | ||
+ return "object"; | ||
+ } | ||
+ | ||
var types = {}; | ||
var type = []; | ||
var i = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import 'db/connect'; | ||
import mongoose from 'mongoose'; | ||
|
||
import { expect, dropData, spy } from 'utils/testing'; | ||
|
||
import ArticleCollection from './model'; | ||
|
||
describe('ArticleCollection model', () => { | ||
const data = { | ||
name: { be: 'Калекцыя' }, | ||
description: { be: 'Цыкл лекцый' }, | ||
articles: [mongoose.Types.ObjectId(), mongoose.Types.ObjectId()], | ||
imageUrl: 'https://collection.jpg', | ||
}; | ||
|
||
before(dropData); | ||
|
||
it('should fail to save collection | no slug', async () => { | ||
const errorHandler = spy(({ message }) => { | ||
expect(message).to.not.empty(); | ||
expect(message.slug).to.include('required'); | ||
}); | ||
|
||
await ArticleCollection(data) | ||
.save() | ||
.catch(errorHandler); | ||
|
||
expect(errorHandler).to.have.been.called(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.