Skip to content

Commit

Permalink
adding workflow + fixing eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gagoar committed Nov 17, 2020
1 parent 0df2632 commit 3bb67fe
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 7 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Validation

on: pull_request

jobs:
lint:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: |
npm install
- name: ESLint
run: npm run lint

test:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm install
- name: Mocha
run: npm run test --coverage
- name: Coveralls
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions src/schema/__tests__/film.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ describe('Film type', async () => {
edges { cursor, node { title } } }
}`;
const nextResult = await swapi(nextQuery);
expect(nextResult.data.allFilms.edges.map(e => e.node.title)).to.deep.equal(
['Return of the Jedi', 'The Phantom Menace'],
);
expect(
nextResult.data.allFilms.edges.map(e => e.node.title),
).to.deep.equal(['Return of the Jedi', 'The Phantom Menace']);
});
});
6 changes: 3 additions & 3 deletions src/schema/__tests__/person.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ describe('Person type', async () => {
edges { cursor, node { name } } }
}`;
const nextResult = await swapi(nextQuery);
expect(nextResult.data.allPeople.edges.map(e => e.node.name)).to.deep.equal(
['R2-D2', 'Darth Vader'],
);
expect(
nextResult.data.allPeople.edges.map(e => e.node.name),
).to.deep.equal(['R2-D2', 'Darth Vader']);
});

describe('Edge cases', () => {
Expand Down
5 changes: 4 additions & 1 deletion src/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ app.get('/schema', (req, res) => {
app.use('/schema.graphql', express.static('./schema.graphql'));

// Finally, serve up the GraphQL Schema itself
app.use('/', graphqlHTTP(() => ({ schema: swapiSchema })));
app.use(
'/',
graphqlHTTP(() => ({ schema: swapiSchema })),
);

module.exports = app;

0 comments on commit 3bb67fe

Please sign in to comment.