forked from lbovet/docson
-
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.
Showing
55 changed files
with
60,436 additions
and
95 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets":[ "env" ] | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
docson.iml | ||
/nbproject | ||
node_modules |
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,11 @@ | ||
# github.com/go-task/task | ||
|
||
version: '2' | ||
|
||
vars: | ||
GREETING: Hello, World! | ||
|
||
tasks: | ||
build-widget: | ||
cmds: | ||
- webpack |
File renamed without changes.
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,105 @@ | ||
const puppeteer = require('puppeteer'); | ||
const path = require('path'); | ||
|
||
jest.setTimeout(500000); | ||
|
||
const server = new Promise( resolve => { | ||
let app = require( '../src/server' )({ directory: path.join( __dirname, '..' ) }); | ||
let server; | ||
server = app.listen( 3000, () => resolve(server) ); | ||
}).catch( e => console.log(e) ); | ||
|
||
const browser = puppeteer.launch({ headless: true }); | ||
|
||
const rootUrl = "http://localhost:3000/public/index.html"; | ||
|
||
beforeAll( async () => { await server }, 50000 ); | ||
afterAll( async () => { | ||
( await server ).close(); | ||
( await browser ).close(); | ||
} ); | ||
|
||
test( 'relative paths', async () => { | ||
const page = await ( await browser ).newPage(); | ||
|
||
await page.goto( rootUrl + "#/integration/schemas/relative.json"); | ||
|
||
await page.waitFor('//*[@id="doc"]/div[1]/div[3]/div[2]/div[2]/div/div[1]/div[3]/div[2]/div[2]/div/div[1]/div[3]/div[2]/div[1]/div[3]/p'); | ||
|
||
let text = await page.evaluate( () => document.querySelector('p').innerText ); | ||
|
||
expect(text).toMatch( 'a baz string' ); | ||
|
||
|
||
await page.close(); | ||
|
||
}); | ||
|
||
test('resolve #definitions in non-root schema', async () => { | ||
const page = await ( await browser ).newPage(); | ||
|
||
await page.goto( rootUrl + "#/integration/schemas/def-non-root/User.json"); | ||
|
||
await page.waitFor(5000); | ||
|
||
await expect( | ||
page.evaluate( () => Array.from(document.querySelectorAll('.property-name').values()).map( s => s.innerText ) ) | ||
).resolves.toContain( 'oderOfFirstLastName' ); | ||
|
||
await page.close(); | ||
|
||
}); | ||
|
||
test('local schema, absolute path', async () => { | ||
const page = await ( await browser ).newPage(); | ||
|
||
await page.goto( rootUrl + "#/integration/schemas/local-absolute/main.json"); | ||
|
||
await page.waitFor(5000); | ||
|
||
await expect( | ||
page.evaluate( () => Array.from(document.querySelectorAll('.desc').values()).map( s => s.innerText ) ) | ||
).resolves.toContain( "a foo number\n" ); | ||
|
||
await page.close(); | ||
|
||
}); | ||
|
||
test('recursive schemas', async () => { | ||
const page = await ( await browser ).newPage(); | ||
|
||
await page.goto( rootUrl + "#/integration/schemas/recursive/circle.json"); | ||
|
||
await page.waitFor(5000); | ||
|
||
await expect( | ||
page.evaluate( () => Array.from(document.querySelectorAll('.desc').values()).map( s => s.innerText ) ) | ||
).resolves.toContain( "circular reference\n" ); | ||
|
||
await page.close(); | ||
}); | ||
|
||
|
||
test('recursive schemas, part II', async () => { | ||
const page = await ( await browser ).newPage(); | ||
|
||
await page.goto( rootUrl + "#/integration/schemas/recursive/within_schema.json"); | ||
await page.waitFor(5000); | ||
|
||
let results = await | ||
page.evaluate( () => Array.from(document.querySelectorAll('p').values()).map( s => s.innerText ) ); | ||
|
||
expect(results).toContain( 'circular definitions' ); | ||
}); | ||
|
||
test('pretty big schema', async () => { | ||
const page = await ( await browser ).newPage(); | ||
|
||
await page.goto( rootUrl + "#/integration/schemas/release-schema.json"); | ||
await page.waitFor( '//*[@id="doc"]/div[1]/div[3]/div[12]/div[2]/div/div[1]/div[3]/div[11]/div[1]/div[3]/p'); | ||
|
||
let results = await | ||
page.evaluate( () => Array.from(document.querySelectorAll('p').values()).map( s => s.innerText ) ); | ||
|
||
expect(results).toContain( 'All documents and attachments related to the contract, including any notices.' ); | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,7 @@ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"foo": { "$ref": "/integration/schemas/local-absolute/foo.json" } | ||
} | ||
} | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.