Skip to content

Commit

Permalink
fix: override transitland_url in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
boredland committed Jun 2, 2022
1 parent 84bd6ad commit 9aaf988
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
release-action:
runs-on: ubuntu-latest
name: release-it
name: release
steps:
- name: checkout
uses: actions/checkout@v3
Expand All @@ -36,6 +36,7 @@ jobs:
run: yarn test
env:
TRANSITLAND_API_KEY: ${{ secrets.TRANSITLAND_API_KEY }}
TRANSITLAND_URL: ${{ secrets.TRANSITLAND_URL }}
- id: changes
name: detect changes
uses: stefanzweifel/git-auto-commit-action@v4
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
test-action:
runs-on: ubuntu-latest
name: release-it
name: test
steps:
- name: checkout
uses: actions/checkout@v3
Expand All @@ -24,3 +24,4 @@ jobs:
run: yarn test
env:
TRANSITLAND_API_KEY: ${{ secrets.TRANSITLAND_API_KEY }}
TRANSITLAND_URL: ${{ secrets.TRANSITLAND_URL }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

![npm](https://img.shields.io/npm/dm/transitland-gql-client)
![GitHub](https://img.shields.io/github/license/boredland/transitland-gql-client)
[![test](https://github.com/boredland/transitland-gql-client/actions/workflows/test.yaml/badge.svg)](https://github.com/boredland/transitland-gql-client/actions/workflows/test.yaml)
[![release](https://github.com/boredland/transitland-gql-client/actions/workflows/release.yaml/badge.svg)](https://github.com/boredland/transitland-gql-client/actions/workflows/release.yaml)

## About
Expand Down
25 changes: 12 additions & 13 deletions src/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import { createClient } from "../dist";

const apiKey = process.env.TRANSITLAND_API_KEY!

it('needs TRANSITLAND_API_KEY to be set', () => {
expect(apiKey).not.toBeUndefined()
expect(apiKey).not.toBeNull()
expect(apiKey).not.toBe("")
expect(process.env.TRANSITLAND_API_KEY).not.toBeUndefined()
expect(process.env.TRANSITLAND_API_KEY).not.toBeNull()
expect(process.env.TRANSITLAND_API_KEY).not.toBe("")
});

it('should have not mutations', () => {
const transitlandClient = createClient({
apiKey: "yolo",
});
const transitlandClient = createClient({
apiKey: process.env.TRANSITLAND_API_KEY!,
url: process.env.TRANSITLAND_URL,
headers: {
Referer: 'https://www.transit.land/',
},
});

it('should have no mutations', () => {
expect(transitlandClient).not.toHaveProperty('mutation')
})

it("can fetch feeds", async () => {
const transitlandClient = createClient({
apiKey,
});

const result = await transitlandClient.query({
feeds: [
{
Expand Down

0 comments on commit 9aaf988

Please sign in to comment.