Skip to content

Commit

Permalink
Merge pull request #68 from the-grid/fix_tests
Browse files Browse the repository at this point in the history
WIP: Fix tests
  • Loading branch information
jonnor committed Nov 16, 2016
2 parents d9b40de + 5a79fdf commit 3800825
Show file tree
Hide file tree
Showing 19 changed files with 341 additions and 97 deletions.
58 changes: 43 additions & 15 deletions examples/contentblock.yml
Expand Up @@ -16,7 +16,7 @@
"@context": "http://schema.org"
author: []
score: 0,
created_at: 1412744992292
created_at: '2014-05-08T13:22:59.000Z'
updated_at: null
text: "AI Websites That Design Themselves"
length: 34
Expand Down Expand Up @@ -44,8 +44,8 @@
filter: true
overlay: true
score: 2
created_at: 1412744992396
updated_at: 1412745215712
created_at: '2014-05-08T13:22:59.000Z'
updated_at: '2014-05-08T15:22:59.000Z'
title: "Dan Tocchini"
caption: "Creator of GSS (Grid Style Sheets) and Partner of D4 Interactive Agency. Producing interactive works for Audi, Microsoft and more."
cover:
Expand All @@ -70,24 +70,31 @@
- [ 148, 148, 164 ]
-
_valid: false
_name: 'missing-type'
_name: 'text-h1-join-evolution-invalid-author'
_data:
id: "bdcc6765-114a-4184-977d-b01d3132ef69"
item: "b04d3a7f-689f-4bc5-a7c6-304b39f271f3"
html: "<p></p>"
-
_valid: false
_name: 'missing-id'
_data:
item: "b04d3a7f-689f-4bc5-a7c6-304b39f271f3"
id: "9a502705-bb6c-4b03-95ee-492dbdd295e4"
item: "8a342d34-bdc1-427d-9b34-4b3392828d69"
type: "h1"
html: "<p></p>"
src: null
html: "<h1>AI Websites That Design Themselves</h1>"
metadata:
title: "Join the Evolution"
datePublished: "2014-10-05T04:37:05.900Z"
description: "AI Websites That Design Themselves\nJoin the Evolution\n\n\nBecome a Founding Member"
"@type": "Product"
"@context": "http://schema.org"
author: 'Not an object'
score: 0,
created_at: '2014-05-08 13:22:59'
updated_at: null
text: "AI Websites That Design Themselves"
length: 34
-
_valid: false
_name: 'missing-item'
_name: 'missing-type'
_data:
id: "bdcc6765-114a-4184-977d-b01d3132ef69"
type: "h4"
item: "b04d3a7f-689f-4bc5-a7c6-304b39f271f3"
html: "<p></p>"
-
_valid: false
Expand Down Expand Up @@ -139,3 +146,24 @@
metadata:
coverPrefs:
crop: "false"
-
_valid: false
_name: 'invalid-created-at'
_data:
id: "9a502705-bb6c-4b03-95ee-492dbdd295e4"
item: "8a342d34-bdc1-427d-9b34-4b3392828d69"
type: "h1"
src: null
html: "<h1>AI Websites That Design Themselves</h1>"
metadata:
title: "Join the Evolution"
datePublished: "2014-10-05T04:37:05.900Z"
description: "AI Websites That Design Themselves\nJoin the Evolution\n\n\nBecome a Founding Member"
"@type": "Product"
"@context": "http://schema.org"
author: []
score: 0,
created_at: 'helloworld'
updated_at: null
text: "AI Websites That Design Themselves"
length: 34
58 changes: 58 additions & 0 deletions examples/navigationentry.yml
@@ -0,0 +1,58 @@
-
_valid: true
_name: 'external-link'
_data:
name: 'Blog'
url: 'https://blog.thegrid.io'
-
_valid: true
_name: 'external-link-mailto'
_data:
name: 'Contact us'
url: 'mailto:info@thegrid.io'
-
_valid: true
_name: 'external-link-tel'
_data:
name: 'Call us'
url: 'tel:+15551234565'
-
_valid: true
_name: 'internal-link'
_data:
name: 'About Us'
id: '0ac76e35-4236-4bc3-b933-e295c1f5bfd7'
-
_valid: false
_name: 'no-link'
_data:
name: 'About Us'
-
_valid: false
_name: 'no-name-external'
_data:
url: 'https://blog.thegrid.io'
-
_valid: false
_name: 'no-name-internal'
_data:
id: '0ac76e35-4236-4bc3-b933-e295c1f5bfd7'
-
_valid: false
_name: 'link-and-id'
_data:
name: 'About Us'
url: 'https://blog.thegrid.io'
id: '0ac76e35-4236-4bc3-b933-e295c1f5bfd7'
-
_valid: false
_name: 'invalid-url'
_data:
name: 'About Us'
url: 'LINK HERE'
-
_valid: false
_name: 'invalid-item'
_data:
name: 'About Us'
id: 'LINK HERE'
2 changes: 1 addition & 1 deletion examples/page.yml
@@ -1,6 +1,6 @@
# Examples of page configs
-
_valid: true
_valid: false
_name: 'new-site-no-items'
_data:
path: "index.html"
Expand Down
26 changes: 23 additions & 3 deletions examples/site.yml
Expand Up @@ -2,17 +2,25 @@
_valid: true
_name: 'minimal'
_data:
id: "059c8aa5-5fac-4bb7-b160-48689bc12a7c"
name: "The Grid"
repo: "the-domains/the-grid"
domain: 'thegrid.io'
owner: "0d1fbca0-ee3c-4157-9881-b03db3e462b9"
-
_valid: true
_name: 'without-owner'
_data:
name: "The Grid"
repo: "the-domains/the-grid"
domain: 'thegrid.io'
-
_valid: true
_name: 'with-config'
_data:
id: "059c8aa5-5fac-4bb7-b160-48689bc12a7c"
name: "The Grid"
repo: "the-domains/the-grid"
domain: 'thegrid.io'
config:
name: 'GSS site'
color:
Expand All @@ -21,14 +29,26 @@
owner: "0d1fbca0-ee3c-4157-9881-b03db3e462b9"
-
_valid: false
_name: 'without-id'
_name: 'without-domain-path'
_data:
name: "The Grid"
repo: "the-domains/the-grid"
owner: "0d1fbca0-ee3c-4157-9881-b03db3e462b9"
-
_valid: false
_name: 'without-owner'
_name: 'invalid-repo'
_data:
id: "059c8aa5-5fac-4bb7-b160-48689bc12a7c"
name: "The Grid"
repo: "the-grid"
path: '/blog'
owner: "0d1fbca0-ee3c-4157-9881-b03db3e462b9"
-
_valid: false
_name: 'invalid-id'
_data:
id: "helloworld"
name: "The Grid"
repo: "the-domains/the-grid"
path: '/blog'
owner: "0d1fbca0-ee3c-4157-9881-b03db3e462b9"
40 changes: 40 additions & 0 deletions examples/sitepurpose.yml
Expand Up @@ -34,3 +34,43 @@
type: 'video'
label: 'Watch the Video'
item: '58864068-f46f-487a-8820-67b81f0d77d3'
-
_valid: false
_name: 'grid-founding-member-no-price'
_data:
type: 'purchase'
label: 'Become a Founding Member'
cta: 'f6a4bd8d-55ec-4c3a-9ccd-9c5f3df80802'
-
_valid: false
_name: 'internal-external-link'
_data:
type: 'video'
label: 'Watch the Video'
item: '58864068-f46f-487a-8820-67b81f0d77d3'
url: 'https://twitter.com/thegrid'
-
_valid: false
_name: 'no-link'
_data:
type: 'video'
label: 'Watch the Video'
-
_valid: false
_name: 'no-type'
_data:
label: 'Watch the Video'
item: '58864068-f46f-487a-8820-67b81f0d77d3'
-
_valid: false
_name: 'no-label'
_data:
type: 'video'
item: '58864068-f46f-487a-8820-67b81f0d77d3'
-
_valid: false
_name: 'invalid-url'
_data:
type: 'purchase'
label: 'Buy our product'
url: 'ENTER LINK HERE'
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -53,7 +53,8 @@
"grunt-yamllint": "^0.2.0",
"json-schema-deref-sync": "^0.3.0",
"mocha": "^2.1.0",
"tv4": "^1.1.9"
"tv4": "^1.1.9",
"tv4-formats": "^2.2.1"
},
"scripts": {
"test": "grunt test"
Expand Down
14 changes: 12 additions & 2 deletions schemata/base.yaml
Expand Up @@ -11,9 +11,19 @@ definitions:
type: string
url:
description: Unique Resource Locator
format: url
format: uri
example: http://thegrid.io
type: string
email:
description: Email address
format: email
example: 'info@thegrid.io'
type: string
hostname:
description: Hostname
format: hostname
example: 'blog.thegrid.io'
type: string
hexcolor:
description: "#RGB color"
format: rgbhexcolor
Expand All @@ -23,6 +33,7 @@ definitions:
site:
type: string
example: "the-domains/the-grid"
pattern: "^[a-z0-9-_\\.]+\/[a-z0-9-_\\.]+$"
sites:
type: array
description: Collection of websites associated with the resource
Expand Down Expand Up @@ -141,4 +152,3 @@ definitions:
-
"$ref": "#/definitions/arraypoint"
description: "Bottom-right point"

24 changes: 17 additions & 7 deletions schemata/contentblock.yaml
Expand Up @@ -38,7 +38,9 @@ definitions:
src:
description: Source URL
example: "http://techcrunch.com/2015/04/15/mozilla-restructure/"
type: [ "string", "null" ]
oneOf:
- { type: 'null' }
- { type: 'string', format: 'uri' }
type:
- object
properties:
Expand All @@ -54,10 +56,18 @@ properties:
"$ref": "#/definitions/src"
metadata:
"$ref": "metadata.json"
created_at: # FIXME: ISOdate,null
type: number
updated_at: # FIXME: ISOdate,null
type: [number, "null"]
anyOf: [headline, text, cta, media, list]
created_at:
type: string
format: 'date-time'
updated_at:
oneOf:
- { type: 'null' }
- { type: 'string', format: 'date-time' }
anyOf:
- { '$ref': 'headline.json' }
- { '$ref': 'text.json' }
- { '$ref': 'cta.json' }
- { '$ref': 'media.json' }
- { '$ref': 'list.json' }

required: [id, item, type, html, src]
required: [type, html]
9 changes: 5 additions & 4 deletions schemata/imagemeasurements.yaml
Expand Up @@ -10,9 +10,11 @@ definitions:
items:
description: "Bounding box of a detected face"
allOf:
"$ref": "base.json#/definitions/bbox"
- { "$ref": "base.json#/definitions/bbox" }
properties:
"$ref": "base.json#/definitions/confidence"
confidence:
name: confidence
"$ref": "base.json#/definitions/confidence"
colors:
description: "Extracted colors from the image, represented as an array of
at least 5 RGB colors"
Expand Down Expand Up @@ -68,8 +70,7 @@ definitions:
type: number
example: 108.079
bounding_rect:
"$ref": "base.json#/definitions/arrayrectangle (warning: to be
deprecated by `regions` bbox)"
"$ref": "base.json#/definitions/arrayrectangle" # (warning: to be deprecated by `regions` bbox)
description: "Rectangle around the salient region"
example: [[329,238],[539,372]]
histogram:
Expand Down
7 changes: 7 additions & 0 deletions schemata/item.yaml
Expand Up @@ -23,5 +23,12 @@ properties:
uniqueItems: true
items:
"$ref": "contentblock.json"
created_at:
type: string
format: 'date-time'
updated_at:
oneOf:
- { type: 'null' }
- { type: 'string', format: 'date-time' }

required: [content]

0 comments on commit 3800825

Please sign in to comment.