Skip to content

Commit

Permalink
add a bunch of tests for various plugins (gatsbyjs#1581)
Browse files Browse the repository at this point in the history
* test: add test scaffolding for plugins

* test: add a simple test for navigateTo

* test: add a bunch of tests

* style: run prettier on tests

* test: fix broken absolute url

* test: fix equality check

* test: (hopefully) fix issue with windows
  • Loading branch information
DSchau authored and KyleAMathews committed Jul 26, 2017
1 parent ef2fa8c commit 5202cad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/__tests__/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { sourceNodes } = require(`../gatsby-node`)

test(`it has a test`, () => {})
20 changes: 20 additions & 0 deletions src/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const path = require(`path`)
const { loadNodeContent } = require(`../`)

describe(`gatsby-source-filesystem`, () => {
it(`can load the content of a file`, async () => {
const content = await loadNodeContent({
absolutePath: path.join(__dirname, `../index.js`),
})

expect(content.length).toBeGreaterThan(0)
})

it(`rejects if file not found`, async () => {
await loadNodeContent({
absolutePath: path.join(__dirname, `haha-not-a-real-file.js`),
}).catch(err => {
expect(err).toBeDefined()
})
})
})

0 comments on commit 5202cad

Please sign in to comment.