Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue-1188: Resolve invalid test endpoint #1189

Closed
wants to merge 4 commits into from
Closed
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ARTISTS_TEST_HTTP_ENDPOINT from '../../../../test-constants';

async function getTemplate(compilation, { route }) {
return `
<html>
Expand Down Expand Up @@ -31,10 +33,10 @@ async function getTemplate(compilation, { route }) {
}

async function getBody(compilation) {
const artists = await fetch('http://www.analogstudios.net/api/artists').then(resp => resp.json());
const artists = await fetch(ARTISTS_TEST_HTTP_ENDPOINT).then(resp => resp.json());
const timestamp = new Date().getTime();
const artistsListItems = artists
.filter(artist => artist.isActive === '1')
.filter(artist => artist.isActive === 1)
.map((artist) => {
const { id, name, bio, imageUrl } = artist;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import ARTISTS_TEST_HTTPS_ENDPOINT from '../../../../test-constants';

export default class UsersPage extends HTMLElement {
async connectedCallback() {
const users = await fetch('https://www.analogstudios.net/api/artists').then(resp => resp.json());
const users = await fetch(ARTISTS_TEST_HTTPS_ENDPOINT).then(resp => resp.json());
const html = users.map(user => {
return `
<section>
Expand Down
6 changes: 4 additions & 2 deletions packages/cli/test/cases/develop.ssr/src/pages/artists.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ARTISTS_TEST_HTTP_ENDPOINT from '../../../../test-constants';

async function getTemplate(compilation, { route }) {
return `
<html>
Expand Down Expand Up @@ -30,10 +32,10 @@ async function getTemplate(compilation, { route }) {
}

async function getBody(compilation) {
const artists = await fetch('http://www.analogstudios.net/api/artists').then(resp => resp.json());
const artists = await fetch(ARTISTS_TEST_HTTP_ENDPOINT).then(resp => resp.json());
const timestamp = new Date().getTime();
const artistsListItems = artists
.filter(artist => artist.isActive === '1')
.filter(artist => artist.isActive === 1)
.map((artist) => {
const { id, name, bio, imageUrl } = artist;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ARTISTS_TEST_HTTPS_ENDPOINT from '../../../../test-constants';
export default class UsersPage extends HTMLElement {
async connectedCallback() {
const users = await fetch('https://www.analogstudios.net/api/artists').then(resp => resp.json());
const users = await fetch(ARTISTS_TEST_HTTPS_ENDPOINT).then(resp => resp.json());
const html = users.map(user => {
return `
<section>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ARTISTS_TEST_HTTP_ENDPOINT from '../../../../test-constants';

async function getTemplate(compilation, { route }) {
return `
<html>
Expand Down Expand Up @@ -31,10 +33,10 @@ async function getTemplate(compilation, { route }) {
}

async function getBody(compilation) {
const artists = await fetch('http://www.analogstudios.net/api/artists').then(resp => resp.json());
const artists = await fetch(ARTISTS_TEST_HTTP_ENDPOINT).then(resp => resp.json());
const timestamp = new Date().getTime();
const artistsListItems = artists
.filter(artist => artist.isActive === '1')
.filter(artist => artist.isActive === 1)
.map((artist) => {
const { id, name, bio, imageUrl } = artist;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ARTISTS_TEST_HTTP_ENDPOINT from '../../../../test-constants';

async function getTemplate(compilation, { route }) {
return `
<html>
Expand Down Expand Up @@ -31,10 +33,10 @@ async function getTemplate(compilation, { route }) {
}

async function getBody(compilation) {
const artists = await fetch('http://www.analogstudios.net/api/artists').then(resp => resp.json());
const artists = await fetch(ARTISTS_TEST_HTTP_ENDPOINT).then(resp => resp.json());
const timestamp = new Date().getTime();
const artistsListItems = artists
.filter(artist => artist.isActive === '1')
.filter(artist => artist.isActive === 1)
.map((artist) => {
const { id, name, bio, imageUrl } = artist;

Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/cases/serve.default.ssr/src/pages/users.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import '../components/card.js';
import ARTISTS_TEST_HTTPS_ENDPOINT from '../../../../test-constants';

export default class UsersPage extends HTMLElement {
async connectedCallback() {
const users = await fetch('https://www.analogstudios.net/api/artists').then(resp => resp.json());
const users = await fetch(ARTISTS_TEST_HTTPS_ENDPOINT).then(resp => resp.json());
const html = users.map(user => {
return `
<wc-card>
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/test/test-constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
ARTISTS_TEST_HTTP_ENDPOINT: 'http://www.analogstudios.net/api/v2/artists',
ARTISTS_TEST_HTTPS_ENDPOINT: 'https://www.analogstudios.net/api/v2/artists'
};
2 changes: 1 addition & 1 deletion www/pages/blog/release/v0-21-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const customExternalSourcesPlugin = {
name: 'source-plugin-artists',
provider: () => {
return async function () {
const artists = await fetch('http://.../api/artists').then(resp => resp.json());
const artists = await fetch('http://.../api/v2/artists').then(resp => resp.json());

return artists.map((artist) => {
const { bio, imageUrl, name } = artist;
Expand Down
2 changes: 1 addition & 1 deletion www/pages/blog/release/v0-23-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ You can add a file to your project in the _pages/_ directory and implement eithe
import fetch from 'node-fetch'; // this needs to be installed from npm

async function getBody() {
const artists = await fetch('http://www.example.com/api/artists').then(resp => resp.json());
const artists = await fetch('http://www.example.com/api/v2/artists').then(resp => resp.json());

return `
<body>
Expand Down
2 changes: 1 addition & 1 deletion www/pages/blog/release/v0-26-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import '../components/card.js';

export default class ArtistsPage extends HTMLElement {
async connectedCallback() {
const artists = await fetch('https://.../api/artists').then(resp => resp.json());
const artists = await fetch('https://.../api/v2/artists').then(resp => resp.json());
const html = artists.map(artist => {
const { name, imageUrl } = artist;

Expand Down
2 changes: 1 addition & 1 deletion www/pages/blog/release/v0-28-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import '../components/card.js';

export default class ArtistsPage extends HTMLElement {
async connectedCallback() {
const artists = await fetch('https://.../api/artists').then(resp => resp.json());
const artists = await fetch('https://.../api/v2/artists').then(resp => resp.json());
const html = artists.map((artist) => {
const { name, imageUrl } = artist;

Expand Down
2 changes: 1 addition & 1 deletion www/pages/blog/state-of-greenwood-2023.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import '../components/card.js';

export default class ArtistsPage extends HTMLElement {
async connectedCallback() {
const artists = await fetch('https://.../api/artists').then(resp => resp.json());
const artists = await fetch('https://.../api/v2/artists').then(resp => resp.json());
const html = artists.map(artist => {
const { name, imageUrl } = artist;

Expand Down
Loading