Permalink
Browse files

Tests! Lints! Packaging!

  • Loading branch information...
1 parent ff9fe95 commit 3aa23ae229a2c7f4645c017afd7b898f85becebe @brev brev committed Dec 15, 2016
Showing 362 changed files with 3,106 additions and 621 deletions.
View
@@ -1,4 +1,5 @@
coverage/
+lib/
node_modules/
public/
stats/
View
@@ -1,4 +1,5 @@
coverage/
+lib/
node_modules/
public/
stats/
View
@@ -221,7 +221,6 @@ directory (`cd packages/numenta.com/`).***
| Test Unit | `npm run test:unit` | Runs just Unit Tests |
| Test Unit Coverage | `npm run test:unit:cover` | Runs unit tests, generate coverage report in `coverage/` directory, and open in browser |
| Test Unit Update | `npm run test:unit:update` | Recreate out-of-date snapshots for Unit tests |
-| Test Unit Watch | `npm run test:unit:watch` | Constantly Re-Runs unit tests while watching for file changes |
## Testing
@@ -244,7 +243,6 @@ Run only unit tests:
```shell
npm run test:unit
-npm run test:unit:watch # auto re-run on changes to test files
```
Unit tests take and use snapshots in order to perform. Make sure new or updated
View
@@ -1,12 +1,11 @@
+- .ORG FAQ PAGE!?
- Shared `/components` need to have theme style vars passed in from each site
- independently somehow.
-- theme.css global what to do?
+ independently somehow. `theme.css` global what to do?
- List status of known out-of-date or custom package in readme
- remind not to do bad SEO links like this: "so to see the stuff, click <here>."
- html tag presize images w/simple fillers for quick loading and
no resizing on mobile
- describe: numenta.com has default/shared/global components, .org starts
splitting off customs.
-- post-Lerna: eslint, stylelint, testing, etc, etc. still messy.
- mention that PDF, Doc/x, TXT should be in `static/resources/`, as everything
in `pages/` needs to be able to lose filename during webpack transpilation.
@@ -1,14 +1,20 @@
import {parse} from 'toml'
import {readFileSync} from 'fs'
-const cwd = process.cwd()
-const file = readFileSync(`${cwd}/packages/numenta.com/config.toml`)
-const config = parse(file)
+// const cwd = process.cwd()
+
+const fileCom = readFileSync('packages/numenta.com/config.toml')
+const configCom = parse(fileCom)
+
+const fileOrg = readFileSync('packages/numenta.org/config.toml')
+const configOrg = parse(fileOrg)
/**
* Jest test Config mock. Return contents of ../config.toml file.
* @requires jest webpack
*/
+const config = Object.assign({}, configCom, configOrg)
+
export default config
@@ -1,5 +1,17 @@
import config from './configMock'
+
+const page = {
+ data: {
+ date: '2016-12-21',
+ title: 'Title',
+ },
+ file: {
+ path: '/papers/test.md',
+ },
+ path: '/papers/test.md',
+}
+
const context = {
config,
manifest: {
@@ -10,11 +22,8 @@ const context = {
version: '0.0.1',
},
route: {
- page: {
- data: {},
- file: {},
- path: '',
- },
+ page,
+ pages: [page],
},
router: {
createHref() {},
View
@@ -80,7 +80,6 @@
"test:links:local": "npm run test:links -- http://0.0.0.0:8000",
"test:unit": "jest --config .jestrc.json \"unit.test\"",
"test:unit:cover": "npm run test:unit -- --coverage && open-url file://$(shx pwd)/coverage/lcov-report/index.html",
- "test:unit:update": "npm run test:unit -- -u",
- "test:unit:watch": "npm run test:unit -- --watch"
+ "test:unit:update": "npm run test:unit -- -u"
}
}
@@ -0,0 +1,4 @@
+{
+ "presets": ["react", "es2015", "stage-0"],
+ "plugins": ["add-module-exports", "transform-class-properties"]
+}
@@ -0,0 +1 @@
+lib/
@@ -1,109 +0,0 @@
-exports[`SocialMedia React component Renders correctly 1`] = `
-<div
- className="social">
- <span
- className="spread">
- <a
- className="imagelink"
- href="https://www.facebook.com/pages/Numenta/321559142118?ref=br_tf"
- onClick={[Function]}
- title="facebook">
- <svg
- fill="currentColor"
- height="1em"
- preserveAspectRatio="xMidYMid meet"
- style={
- Object {
- "color": "inherit",
- "verticalAlign": "middle",
- }
- }
- viewBox="0 0 40 40"
- width="1em">
- <g>
- <path
- d="m29.4 0.3v5.9h-3.5q-1.9 0-2.6 0.8t-0.7 2.4v4.2h6.6l-0.9 6.6h-5.7v16.9h-6.8v-16.9h-5.7v-6.6h5.7v-4.9q0-4.1 2.3-6.4t6.2-2.3q3.3 0 5.1 0.3z" />
- </g>
- </svg>
- </a>
- </span>
- <span
- className="spread">
- <a
- className="imagelink"
- href="https://twitter.com/numenta"
- onClick={[Function]}
- title="twitter">
- <svg
- fill="currentColor"
- height="1em"
- preserveAspectRatio="xMidYMid meet"
- style={
- Object {
- "color": "inherit",
- "verticalAlign": "middle",
- }
- }
- viewBox="0 0 40 40"
- width="1em">
- <g>
- <path
- d="m37.7 9.1q-1.5 2.2-3.7 3.7 0.1 0.3 0.1 1 0 2.9-0.9 5.8t-2.6 5.5-4.1 4.7-5.7 3.3-7.2 1.2q-6.1 0-11.1-3.3 0.8 0.1 1.7 0.1 5 0 9-3-2.4-0.1-4.2-1.5t-2.6-3.5q0.8 0.1 1.4 0.1 1 0 1.9-0.3-2.5-0.5-4.1-2.5t-1.7-4.6v0q1.5 0.8 3.3 0.9-1.5-1-2.4-2.6t-0.8-3.4q0-2 0.9-3.7 2.7 3.4 6.6 5.4t8.3 2.2q-0.2-0.9-0.2-1.7 0-3 2.1-5.1t5.1-2.1q3.2 0 5.3 2.3 2.4-0.5 4.6-1.7-0.8 2.5-3.2 3.9 2.1-0.2 4.2-1.1z" />
- </g>
- </svg>
- </a>
- </span>
- <span
- className="spread">
- <a
- className="imagelink"
- href="https://www.youtube.com/user/numenta"
- onClick={[Function]}
- title="youtube">
- <svg
- fill="currentColor"
- height="1em"
- preserveAspectRatio="xMidYMid meet"
- style={
- Object {
- "color": "inherit",
- "verticalAlign": "middle",
- }
- }
- viewBox="0 0 40 40"
- width="1em">
- <g>
- <path
- d="m24.7 27.8v4.7q0 1.5-0.9 1.5-0.5 0-1-0.5v-6.7q0.5-0.5 1-0.5 0.9 0 0.9 1.5z m7.5 0v1h-2v-1q0-1.5 1-1.5t1 1.5z m-21.5-4.9h2.3v-2.1h-6.9v2.1h2.3v12.7h2.3v-12.7z m6.4 12.7h2v-11h-2v8.4q-0.7 1-1.3 1-0.4 0-0.5-0.5 0-0.1 0-0.8v-8.1h-2v8.7q0 1.1 0.2 1.7 0.3 0.8 1.3 0.8 1.1 0 2.3-1.4v1.2z m9.6-3.3v-4.4q0-1.6-0.2-2.2-0.4-1.2-1.6-1.2-1.1 0-2.1 1.2v-4.9h-2v14.8h2v-1q1 1.2 2.1 1.2 1.2 0 1.6-1.2 0.2-0.6 0.2-2.3z m7.5-0.2v-0.3h-2q0 1.1-0.1 1.4-0.1 0.8-0.9 0.8-1 0-1-1.6v-1.9h4v-2.3q0-1.8-0.6-2.6-0.9-1.1-2.4-1.1-1.5 0-2.4 1.1-0.6 0.8-0.6 2.6v3.9q0 1.7 0.7 2.5 0.8 1.2 2.4 1.2 1.6 0 2.4-1.2 0.4-0.6 0.5-1.2 0-0.2 0-1.3z m-13.6-20.4v-4.7q0-1.5-0.9-1.5t-1 1.5v4.7q0 1.6 1 1.6t0.9-1.6z m16.1 16.8q0 5.2-0.6 7.8-0.3 1.3-1.3 2.2t-2.3 1q-4.1 0.5-12.4 0.5t-12.3-0.5q-1.3-0.1-2.3-1t-1.3-2.2q-0.6-2.5-0.6-7.8 0-5.2 0.6-7.8 0.3-1.3 1.3-2.2t2.3-1.1q4.1-0.4 12.3-0.4t12.4 0.4q1.3 0.2 2.3 1.1t1.3 2.2q0.6 2.5 0.6 7.8z m-22.3-28.5h2.3l-2.7 8.9v6.1h-2.2v-6.1q-0.4-1.6-1.4-4.7-0.8-2.3-1.5-4.2h2.4l1.6 5.9z m8.3 7.4v3.9q0 1.8-0.7 2.7-0.8 1.1-2.3 1.1-1.5 0-2.4-1.1-0.6-0.9-0.6-2.7v-3.9q0-1.8 0.6-2.6 0.9-1.1 2.4-1.1 1.5 0 2.3 1.1 0.7 0.8 0.7 2.6z m7.4-3.6v11.2h-2v-1.3q-1.2 1.4-2.3 1.4-1 0-1.3-0.8-0.2-0.5-0.2-1.7v-8.8h2v8.2q0 0.7 0.1 0.8 0 0.5 0.4 0.5 0.6 0 1.3-1v-8.5h2z" />
- </g>
- </svg>
- </a>
- </span>
- <span
- className="spread">
- <a
- className="imagelink"
- href="https://www.linkedin.com/company/numenta"
- onClick={[Function]}
- title="linkedin">
- <svg
- fill="currentColor"
- height="1em"
- preserveAspectRatio="xMidYMid meet"
- style={
- Object {
- "color": "inherit",
- "verticalAlign": "middle",
- }
- }
- viewBox="0 0 40 40"
- width="1em">
- <g>
- <path
- d="m10.8 13.9v22.2h-7.4v-22.1h7.4z m0.5-6.8q0 1.7-1.2 2.7t-3 1.1h0q-1.9 0-3-1.1t-1.1-2.7q0-1.6 1.2-2.7t3-1.1 2.9 1.1 1.2 2.7z m26 16.3v12.7h-7.4v-11.9q0-2.3-0.9-3.6t-2.8-1.4q-1.4 0-2.3 0.8t-1.5 1.9q-0.2 0.7-0.2 1.8v12.4h-7.3q0-8.9 0-14.5t0-6.6l0-1h7.3v3.2h-0.1q0.5-0.7 1-1.3t1.2-1.1 2-1 2.5-0.4q3.8 0 6.2 2.6t2.3 7.4z" />
- </g>
- </svg>
- </a>
- </span>
-</div>
-`;
@@ -30,10 +30,23 @@
"superagent": "3.2.1",
"xss-filters": "1.2.7"
},
- "devDependencies": {},
+ "devDependencies": {
+ "babel-cli": "6.18.0",
+ "babel-core": "6.20.0",
+ "babel-plugin-add-module-exports": "0.2.1",
+ "babel-plugin-transform-class-properties": "6.19.0",
+ "babel-preset-es2015": "6.18.0",
+ "babel-preset-react": "6.16.0",
+ "babel-preset-react-hmre": "1.1.1",
+ "babel-preset-stage-0": "6.16.0"
+ },
"repository": {
"type": "git",
"url": "https://github.com/numenta/numenta-web"
},
- "scripts": {}
+ "scripts": {
+ "build": "npm run compile",
+ "compile": "babel --ignore __tests__ --out-dir lib/ --source-maps true src/",
+ "postinstall": "npm run build"
+ }
}
@@ -6,7 +6,7 @@ import {IndexLink, Link} from 'react-router'
import {prefixLink} from 'gatsby-helpers'
import React from 'react'
-import {triggerGAnalyticsEvent} from 'numenta-web-shared-utils/client'
+import {triggerGAnalyticsEvent} from 'numenta-web-shared-utils/lib/client'
import styles from './index.css'
@@ -7,7 +7,7 @@ import {prefixLink} from 'gatsby-helpers'
import React from 'react'
import url from 'url'
-import {triggerGAnalyticsEvent} from 'numenta-web-shared-utils/client'
+import {triggerGAnalyticsEvent} from 'numenta-web-shared-utils/lib/client'
import styles from './index.css'
@@ -4,7 +4,7 @@
import React from 'react'
-import {trims} from 'numenta-web-shared-utils/shared'
+import {trims} from 'numenta-web-shared-utils/lib/shared'
/**
@@ -2,7 +2,7 @@
// MIT License (see LICENSE.txt)
// Copyright © 2005—2017 Numenta <http://numenta.com>
-import {getEventTimeDisplay} from 'numenta-web-shared-utils/shared'
+import {getEventTimeDisplay} from 'numenta-web-shared-utils/lib/shared'
import moment from 'moment'
import React from 'react'
@@ -8,7 +8,7 @@ import lunr from 'lunr'
import {prefixLink} from 'gatsby-helpers'
import React from 'react'
import request from 'superagent'
-import {stampUrl} from 'numenta-web-shared-utils/shared'
+import {stampUrl} from 'numenta-web-shared-utils/lib/shared'
import Button from '../Button'
import Form from '../Form'
@@ -2,8 +2,8 @@
// MIT License (see LICENSE.txt)
// Copyright © 2005—2017 Numenta <http://numenta.com>
-import {getBrowserWidth} from 'numenta-web-shared-utils/client'
-import {getModalWidth} from 'numenta-web-shared-utils/shared'
+import {getBrowserWidth} from 'numenta-web-shared-utils/lib/client'
+import {getModalWidth} from 'numenta-web-shared-utils/lib/shared'
import {unescape} from 'lodash'
import Highlight from 'react-highlighter'
import Modal from 'react-modal'
@@ -7,7 +7,7 @@ import IconAngleUp from 'react-icons/lib/fa/angle-up'
import {prefixLink} from 'gatsby-helpers'
import React from 'react'
-import {hasSessionStorage} from 'numenta-web-shared-utils/client'
+import {hasSessionStorage} from 'numenta-web-shared-utils/lib/client'
import SectionTitle from '../SectionTitle'
@@ -0,0 +1,31 @@
+exports[`SocialMedia React component Renders correctly 1`] = `
+<div
+ className="social">
+ <span
+ className="spread">
+ <a
+ className="imagelink"
+ href="https://www.youtube.com/c/NumentaOrg"
+ onClick={[Function]}
+ title="youtube">
+ <svg
+ fill="currentColor"
+ height="1em"
+ preserveAspectRatio="xMidYMid meet"
+ style={
+ Object {
+ "color": "inherit",
+ "verticalAlign": "middle",
+ }
+ }
+ viewBox="0 0 40 40"
+ width="1em">
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.6-0.9-0.6-2.7v-3.9q0-1.8 0.6-2.6 0.9-1.1 2.4-1.1 1.5 0 2.3 1.1 0.7 0.8 0.7 2.6z m7.4-3.6v11.2h-2v-1.3q-1.2 1.4-2.3 1.4-1 0-1.3-0.8-0.2-0.5-0.2-1.7v-8.8h2v8.2q0 0.7 0.1 0.8 0 0.5 0.4 0.5 0.6 0 1.3-1v-8.5h2z" />
+ </g>
+ </svg>
+ </a>
+ </span>
+</div>
+`;
@@ -26,14 +26,20 @@ const SocialMedia = (props, {config}) => {
for (const site in sites) {
if ({}.hasOwnProperty.call(sites, site)) {
const Component = sites[site]
- const title = site.match(/(\w+)\.com/)[1]
- socials.push(
- <span className={styles.spread} key={title}>
- <ImageLink title={title} to={site}>
- <Component color="inherit" />
- </ImageLink>
- </span>
- )
+ const titles = site.match(/(\w+)\.com/)
+ let title
+
+ if (titles && titles.length > 0) {
+ title = titles.pop()
+
+ socials.push(
+ <span className={styles.spread} key={title}>
+ <ImageLink title={title} to={site}>
+ <Component color="inherit" />
+ </ImageLink>
+ </span>
+ )
+ }
}
}
@@ -6,7 +6,7 @@ import {IndexLink, Link} from 'react-router'
import {prefixLink} from 'gatsby-helpers'
import React from 'react'
-import {triggerGAnalyticsEvent} from 'numenta-web-shared-utils/client'
+import {triggerGAnalyticsEvent} from 'numenta-web-shared-utils/lib/client'
import styles from './index.css'
@@ -30,8 +30,6 @@ const TextLink = ({children, onClick, target, to}) => {
}
let Node = Link
- if (!to) throw new Error('missing TextLink attr [to]', to)
-
if (to && (
to.match(/^.+:/) || to.match(/^\/assets\//) || to.match(/\.pdf$/)
)) {
Oops, something went wrong.

0 comments on commit 3aa23ae

Please sign in to comment.