Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SWAPI GraphQL Wrapper
=====================

A wrapper around [SWAPI](http://swapi.co) built using GraphQL converting it into [this schema](schema.graphql).
A wrapper around [SWAPI](http://swapi.dev) built using GraphQL converting it into [this schema](schema.graphql).

Uses:

Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SWAPI GraphQL Wrapper",
"description": "A wrapper around [SWAPI](http://swapi.co) built using GraphQL.",
"description": "A wrapper around [SWAPI](http://swapi.dev) built using GraphQL.",
"repository": "https://github.com/graphql/swapi-graphql",
"keywords": ["graphql", "swapi", "swapi-graphql"]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swapi-graphql",
"description": "A GraphQL wrapper for swapi.com",
"description": "A GraphQL wrapper for swapi.devm",
"contributors": [
"Nicholas Schrock <[email protected]>",
"Daniel Schafer <[email protected]>"
Expand Down
10 changes: 5 additions & 5 deletions src/api/__tests__/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ import { getFromLocalUrl } from '../local';

describe('Local API Wrapper', () => {
it('Gets a person', async () => {
const luke = await getFromLocalUrl('https://swapi.co/api/people/1/');
const luke = await getFromLocalUrl('https://swapi.dev/api/people/1/');
expect(luke.name).to.equal('Luke Skywalker');
const threePO = await getFromLocalUrl('https://swapi.co/api/people/2/');
const threePO = await getFromLocalUrl('https://swapi.dev/api/people/2/');
expect(threePO.name).to.equal('C-3PO');
});

it('Gets pages', async () => {
const firstPeople = await getFromLocalUrl('https://swapi.co/api/people/');
const firstPeople = await getFromLocalUrl('https://swapi.dev/api/people/');
expect(firstPeople.results.length).to.equal(10);
expect(firstPeople.results[0].name).to.equal('Luke Skywalker');
const secondPeople = await getFromLocalUrl(
'https://swapi.co/api/people/?page=2',
'https://swapi.dev/api/people/?page=2',
);
expect(secondPeople.results.length).to.equal(10);
expect(secondPeople.results[0].name).to.equal('Anakin Skywalker');
});

it('Gets first page by default', async () => {
const people = await getFromLocalUrl('https://swapi.co/api/people/');
const people = await getFromLocalUrl('https://swapi.dev/api/people/');
expect(people.results.length).to.equal(10);
expect(people.results[0].name).to.equal('Luke Skywalker');
});
Expand Down
4 changes: 2 additions & 2 deletions src/schema/__tests__/apiHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import {

describe('API Helper', () => {
it('Gets a person', async () => {
const luke = await getObjectFromUrl('https://swapi.co/api/people/1/');
const luke = await getObjectFromUrl('https://swapi.dev/api/people/1/');
expect(luke.name).to.equal('Luke Skywalker');
const threePO = await getObjectFromUrl('https://swapi.co/api/people/2/');
const threePO = await getObjectFromUrl('https://swapi.dev/api/people/2/');
expect(threePO.name).to.equal('C-3PO');
});

Expand Down
4 changes: 2 additions & 2 deletions src/schema/apiHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export async function getObjectFromTypeAndId(
type: string,
id: string,
): Promise<Object> {
return await getObjectFromUrl(`https://swapi.co/api/${type}/${id}/`);
return await getObjectFromUrl(`https://swapi.dev/api/${type}/${id}/`);
}

type ObjectsByType = {
Expand All @@ -52,7 +52,7 @@ type ObjectsByType = {
*/
export async function getObjectsByType(type: string): Promise<ObjectsByType> {
let objects = [];
let nextUrl = `https://swapi.co/api/${type}/`;
let nextUrl = `https://swapi.dev/api/${type}/`;
while (nextUrl) {
// eslint-disable-next-line no-await-in-loop
const pageData = await localUrlLoader.load(nextUrl);
Expand Down