-
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.
Merge pull request #3 from data-depot/staging
chore: release v0.0.1
- Loading branch information
Showing
15 changed files
with
113 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
node_modules | ||
dist | ||
.env | ||
coverage/ |
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,2 @@ | ||
@thinkempirenyc:registry=https://npm.pkg.github.com | ||
//npm.pkg.github.com/:_authToken=PERSONAL_GITHUB_ACCESS_TOKEN |
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,5 @@ | ||
# soda-ts | ||
|
||
[![codecov](https://codecov.io/gh/data-depot/soda-ts/branch/staging/graph/badge.svg?token=6996L6JATW)](https://codecov.io/gh/data-depot/soda-ts) | ||
|
||
## A simple library to interact with open data |
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 |
---|---|---|
@@ -1,4 +1,13 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node' | ||
testEnvironment: 'node', | ||
setupFilesAfterEnv: ['./config/testSetup.ts'], | ||
coverageThreshold: { | ||
global: { | ||
branches: 80, | ||
functions: 90, | ||
lines: 90, | ||
statements: 90 | ||
} | ||
} | ||
} |
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
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,5 +1,3 @@ | ||
import './env' | ||
|
||
export * from './clauses' | ||
export * from './createRunner' | ||
export * from './query' | ||
|
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
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,46 @@ | ||
import { createQuery } from '../src' | ||
|
||
const SRC = 'w7w3-xahh' | ||
const DOMAIN = 'data.cityofnewyork.us' | ||
|
||
describe('query', () => { | ||
it('queryCreator', () => { | ||
const query = createQuery(SRC) | ||
|
||
expect(query).toStrictEqual({ | ||
src: SRC, | ||
domain: DOMAIN, | ||
apiPath: 'resource', | ||
clauses: [] | ||
}) | ||
}) | ||
|
||
it('custom domain', () => { | ||
const DOMAIN = 'test.test.nyc' | ||
const query = createQuery(SRC, { | ||
domain: DOMAIN | ||
}) | ||
|
||
expect(query.domain).toBe(DOMAIN) | ||
}) | ||
|
||
it('default domain', () => { | ||
const query = createQuery(SRC) | ||
|
||
expect(query.domain).toBe('data.cityofnewyork.us') | ||
}) | ||
|
||
it('default api path', () => { | ||
const query = createQuery(SRC) | ||
|
||
expect(query.apiPath).toBe('resource') | ||
}) | ||
|
||
it('set api path', () => { | ||
const query = createQuery(SRC, { | ||
apiPath: 'api/catalog/v1' | ||
}) | ||
|
||
expect(query.apiPath).toBe('api/catalog/v1') | ||
}) | ||
}) |
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,40 @@ | ||
import { createRunner, createQuery, Query } from '../src' | ||
|
||
describe('createRunner', () => { | ||
let query: Query | ||
let runner: ReturnType<typeof createRunner> | ||
|
||
const authOpts = { | ||
appToken: process.env.APP_TOKEN | ||
} | ||
|
||
let authenticatedRunner: ReturnType<typeof createRunner> | ||
|
||
beforeAll(() => { | ||
query = createQuery('w7w3-xahh') | ||
runner = createRunner() | ||
authenticatedRunner = createRunner(authOpts) | ||
}) | ||
|
||
it('successfully grabs ', async () => { | ||
const res = await runner(query) | ||
|
||
expect(res.length).toBeGreaterThan(1) | ||
}) | ||
|
||
it('successfully grabs with authentication ', async () => { | ||
expect(authOpts.appToken).not.toBeUndefined() | ||
const res = await authenticatedRunner(query) | ||
expect(res.length).toBeGreaterThan(1) | ||
}) | ||
|
||
it('runner fails when invalid token provided', async () => { | ||
const misAuthenticatedRunner = createRunner({ | ||
appToken: 'au7shiadu7fhdas7s' | ||
}) | ||
|
||
await expect( | ||
misAuthenticatedRunner(query) | ||
).rejects.toThrow() | ||
}) | ||
}) |