Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
70 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict' | ||
|
||
const test = require('ava') | ||
|
||
test('ava works ok', t => { | ||
t.true(true) | ||
}) |
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,10 +1,12 @@ | ||
'use strict' | ||
|
||
const tap = require('tap') | ||
const test = require('ava') | ||
const pkg = require('../../package.json') | ||
const dependencies = pkg.dependencies || {} | ||
|
||
Object.keys(dependencies).forEach((dependency) => { | ||
const module = require(dependency) | ||
tap.ok(module, `${dependency} loads ok`) | ||
test(`${dependency} loads ok`, t => { | ||
const module = require(dependency) | ||
t.truthy(module) | ||
}) | ||
}) |
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,10 +1,12 @@ | ||
'use strict' | ||
|
||
const tap = require('tap') | ||
const test = require('ava') | ||
const pkg = require('../../package.json') | ||
const dependencies = pkg.devDependencies || {} | ||
|
||
Object.keys(dependencies).forEach((dependency) => { | ||
const module = require(dependency) | ||
tap.ok(module, `${dependency} loads ok`) | ||
test(`${dependency} loads ok`, t => { | ||
const module = require(dependency) | ||
t.truthy(module) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
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,42 @@ | ||
'use strict' | ||
|
||
const test = require('ava') | ||
const listen = require('test-listen') | ||
const axios = require('axios') | ||
const micro = require('micro') | ||
const srv = require('../../index') | ||
|
||
const getUrl = fn => { | ||
const srv = micro(fn) | ||
return listen(srv) | ||
} | ||
|
||
test('it returns README as frontpage', async t => { | ||
const url = await getUrl(srv) | ||
const result = await axios.get(url) | ||
t.true(result.data.includes('MIT'), 'frontpage ok') | ||
}) | ||
|
||
test('it returns json for sub entity from GET', async t => { | ||
const url = await getUrl(srv) | ||
const result = await axios.get(`${url}?organisasjonsnummer=974760673`) | ||
t.deepEqual(result.data.organisasjonsnummer, 974760673, 'json ok') | ||
}) | ||
|
||
test('it returns json for sub entity from POST', async t => { | ||
const url = await getUrl(srv) | ||
const result = await axios.post(`${url}`, {organisasjonsnummer: '974760673'}) | ||
t.deepEqual(result.data.organisasjonsnummer, 974760673, 'json ok') | ||
}) | ||
|
||
test('it returns json for main entity from GET', async t => { | ||
const url = await getUrl(srv) | ||
const result = await axios.get(`${url}?organisasjonsnummer=912660680`) | ||
t.deepEqual(result.data.organisasjonsnummer, 912660680, 'json ok') | ||
}) | ||
|
||
test('it returns json for main entity from POST', async t => { | ||
const url = await getUrl(srv) | ||
const result = await axios.post(`${url}`, {organisasjonsnummer: '912660680'}) | ||
t.deepEqual(result.data.organisasjonsnummer, 912660680, 'json ok') | ||
}) |