forked from confused-Techie/atom-backend
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved testing of package objects, fixed bugs found by this, implem…
…ented it's usage elsewhere
- Loading branch information
1 parent
c74f305
commit 2ea0e16
Showing
10 changed files
with
207 additions
and
15 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
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
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,12 @@ | ||
module.exports = { | ||
schema: { | ||
|
||
}, | ||
example: [ | ||
require("./packageObjectFull.js").example | ||
] | ||
test: | ||
Joi.array().items( | ||
require("./packageObjectFull.js").test | ||
).required() | ||
}; |
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,131 @@ | ||
module.exports = { | ||
schema: { | ||
description: "A 'Package Object Short' of a package on the PPR.", | ||
type: "object", | ||
required: [ | ||
"name", "readme", "metadata", "repository", "downloads", "stargazers_count", | ||
"releases", "badges" | ||
], | ||
properties: { | ||
name: { type: "string" }, | ||
readme: { type: "string" }, | ||
metadata: { type: "object" }, | ||
repository: { type: "object" }, | ||
creation_method: { type: "string" }, | ||
downloads: { type: "string" }, | ||
stargazers_count: { type: "string" }, | ||
releases: { type: "object" }, | ||
badges: { type: "array" } | ||
} | ||
}, | ||
example: { | ||
// Example taken from `platformio-ide-terminal` | ||
name: "platformio-ide-terminal", | ||
readme: "This is the full content of a readme file!", | ||
metadata: { | ||
main: "./lib/plaformio-ide-terminal", | ||
name: "platformio-ide-terminal", | ||
// This could be an author object | ||
author: "Jeremy Ebneyamin", | ||
engines: { | ||
atom: ">=1.12.2 <2.0.0" | ||
}, | ||
license: "MIT", | ||
version: "2.10.1", | ||
homepage: "https://atom.io/packages/platformio=ide-terminal", | ||
keywords: [ | ||
"PlatformIO", | ||
"terminal-plus", | ||
"terminal" | ||
], | ||
repository: "https://github.com/platformio/platformio-iatom-ide-terminal", | ||
description: "A terminal package for Atom, complete with themes, API and more for PlatformIO IDE. Fork of terminal-plus.", | ||
contributors: [ | ||
{ | ||
url: "http://platformio.org", | ||
name: "Ivan Kravets", | ||
email: "[email protected]" | ||
} | ||
], | ||
dependencies: { | ||
"term.js": "https://github.com/jeremyramin/term.js/tarball/master", | ||
underscore: "^1.8.3", | ||
"atom-psace-pen-views": "^2.2.0", | ||
"node-pty-prebuilt-multiarch": "^0.9.0" | ||
}, | ||
activationHooks: [ | ||
"core:loaded-shell-encironmnet" | ||
], | ||
consumedServices: { | ||
"status-bar": { | ||
versions: { | ||
"^1.0.0": "consumeStatusBar" | ||
} | ||
} | ||
}, | ||
providedServices: { | ||
runInTerminal: { | ||
versions: { | ||
"0.14.5": "provideRunInTerminal" | ||
}, | ||
description: "Deprecated API for PlatformIO IDE 1.0" | ||
} | ||
} | ||
}, | ||
repository: { | ||
url: "https://github.com/platformio/platformio-atom-ide-terminal", | ||
type: "git" | ||
}, | ||
creation_method: "User Made Package", | ||
downloads: "16997915", | ||
stargazers_count: "1114", | ||
releases: { | ||
latest: "2.10.1" | ||
}, | ||
badges: [] | ||
}, | ||
test: | ||
Joi.object({ | ||
name: Joi.string().required(), | ||
readme: Joi.string().required(), | ||
metadata: Joi.object().required(), | ||
releases: Joi.object({ | ||
latest: Joi.string().required() | ||
}).required(), | ||
repository: Joi.object({ | ||
url: Joi.string().required(), | ||
type: Joi.string().valid( | ||
"git", | ||
"bit", | ||
"sfr", | ||
"lab", | ||
"berg", | ||
"unknown", | ||
"na" | ||
).required() | ||
}).required(), | ||
creation_method: Joi.string().valid( | ||
"User Made Package", | ||
"Migrated from Atom.io", | ||
"Test Package" // Should only be used during tests | ||
).required(), | ||
downloads: Joi.string().pattern(/^[0-9]+$/).required(), | ||
stargazers_count: Joi.string().pattern(/^[0-9]+$/).required(), | ||
badges:Joi.array().items( | ||
Joi.object({ | ||
title: Joi.string().valid( | ||
"Outdated", | ||
"Made for Pulsar!", | ||
"Broken", | ||
"Archived", | ||
"Deprecated" | ||
).required(), | ||
type: Joi.string().valid( | ||
"warn", "info", "success" | ||
).required(), | ||
text: Joi.string(), | ||
link: Joi.string() | ||
}) | ||
).required() | ||
}).required() | ||
}; |
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,12 @@ | ||
module.exports = { | ||
schema: { | ||
|
||
}, | ||
example: [ | ||
require("./packageObjectShort.js").example | ||
], | ||
test: | ||
Joi.array().items( | ||
require("./packageObjectShort.js").test | ||
).required() | ||
}; |