Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-source-hire-with-google

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-source-hire-with-google - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

10

gatsby-node.js

@@ -22,6 +22,2 @@ "use strict";

const config = {
maxRedirects: 0
};
const generateBaseUrl = companyName => `https://hire.withgoogle.com/v2/api/t/${companyName}/public/jobs`;

@@ -42,3 +38,5 @@

const _ref = yield _axios.default.get(URL, config),
const _ref = yield _axios.default.get(URL, {
maxRedirects: 0
}),
data = _ref.data,

@@ -66,3 +64,3 @@ status = _ref.status;

const createNode = boundActionCreators.createNode;
const jobs = yield getJobs(config);
const jobs = yield getJobs(companyName);
jobs.forEach(job => {

@@ -69,0 +67,0 @@ const jsonString = JSON.stringify(job);

6

package.json
{
"name": "gatsby-source-hire-with-google",
"version": "1.0.0",
"version": "1.0.1",
"description": "Gatsby source plugin for loading job openings from hire.withgoogle.com",
"main": "gatsby-node.js",
"scripts": {
"build": "ava && babel src --out-dir .",
"test": "ava"
"build": "babel src/*.js --out-dir .",
"test": "npm run build && ava src/test"
},

@@ -10,0 +10,0 @@ "repository": {

@@ -0,4 +1,13 @@

# gatsby-source-hire-with-google
> Loads job openings from Hire With Google into Gatsby.js.
Loads job openings from Hire With Google into Gatsby.js.
---
<center>
<img src="https://api.travis-ci.org/reimertz/gatsby-source-hire-with-google.svg?branch=master"/>
</center>
## Installation

@@ -5,0 +14,0 @@

import crypto from 'crypto'
import axios from 'axios'
const config = {
maxRedirects: 0
}
export const generateBaseUrl = (companyName) => `https://hire.withgoogle.com/v2/api/t/${companyName}/public/jobs`

@@ -15,3 +11,3 @@

const URL = generateBaseUrl(companyName)
const { data, status } = await axios.get(URL, config)
const { data, status } = await axios.get(URL, { maxRedirects: 0 })

@@ -27,3 +23,3 @@ return data

const { createNode } = boundActionCreators
const jobs = await getJobs(config)
const jobs = await getJobs(companyName)

@@ -30,0 +26,0 @@ jobs.forEach(job => {

import test from 'ava';
import { generateBaseUrl, getJobs, sourceNodes } from '../../gatsby-node'
import { generateBaseUrl, getJobs, sourceNodes } from '../gatsby-node'
const TEST_COMPANY = 'dromae'
const TEST_COMPANY_THAT_DOESNT_EXIST = 'REIMERTZ_YOLO_COMPANY_1337'
const CONFIG = { companyName: TEST_COMPANY }
const GATSY_MOCK = {
boundActionCreators: {
createNode: (nodeData) => {}
}
}

@@ -28,2 +33,24 @@ test(`generateBaseUrl(${TEST_COMPANY}) should output https://hire.withgoogle.com/v2/api/t/${TEST_COMPANY}/public/jobs`, t => {

t.is(error.message, `Couldn't fetch jobs for ${TEST_COMPANY_THAT_DOESNT_EXIST}. You sure ${generateBaseUrl(TEST_COMPANY_THAT_DOESNT_EXIST)} exists?`);
});
});
test(`sourceNodes(gatsyMock, {configName: '${TEST_COMPANY}'}) run without issues`, async t => {
try {
await sourceNodes(GATSY_MOCK, CONFIG)
t.pass('sourceNodes function passed. :)')
} catch (e) {
console.log(e)
}
});
test(`sourceNodes(gatsyMock, {}) should fail`, async t => {
try {
await sourceNodes(GATSY_MOCK, {})
t.fail('sourceNodes with missing companyName did not fail')
} catch (e) {
t.is(e.message, 'You need to define companyName in gatsby-config.js.');
}
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc