Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Test
  • Loading branch information
RoyEJohnson committed Sep 6, 2025
commit ca14f3d26b024146b75a6c441c2c57b1ec818464
4 changes: 4 additions & 0 deletions test/helpers/fetch-mocker.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import faq from '../src/data/faq';
import flags from '../src/data/flags';
import footerData from '../src/data/footer';
import formHeadings from '../src/data/form-headings';
import globalReachData from '../src/data/global-reach';
import impact from '../src/data/impact';
import institutionalPartnershipData from '../src/data/institutional-partnership';
import kineticData from '../src/data/kinetic';
Expand Down Expand Up @@ -74,6 +75,7 @@ global.fetch = jest.fn().mockImplementation((...args) => {
const isFooter = (/api\/footer/).test(args[0]);
const isFormHeading = (/form-headings/).test(args[0]);
const isGiveBanner = args[0].endsWith('snippets/givebanner/');
const isGlobalReach = args[0].includes('/global-reach/');
const isImpact = args[0].includes('/pages/impact');
const isInstitutionalPartnership = (/pages\/institutional-partners/).test(args[0]);
const isKinetic = args[0].endsWith('kinetic/');
Expand Down Expand Up @@ -144,6 +146,8 @@ global.fetch = jest.fn().mockImplementation((...args) => {
payload = formHeadings;
} else if (isGiveBanner) {
payload = {};
} else if (isGlobalReach) {
payload = globalReachData;
} else if (isHomepage) {
payload = openstaxHomepageData;
} else if (isImpact) {
Expand Down
115 changes: 115 additions & 0 deletions test/src/data/global-reach.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
export default {
id: 306,
meta: {
slug: 'global-reach',
seo_title: '',
search_description: '',
type: 'pages.MapPage',
detail_url: 'https://openstax.org/apps/cms/api/v2/pages/306/',
html_url: 'https://openstax.org/global-reach/',
show_in_menus: false,
first_published_at: '2019-02-22T14:05:25.269000-06:00',
alias_of: null,
parent: {
id: 821,
meta: {
type: 'pages.RootPage',
detail_url: 'https://openstax.org/apps/cms/api/v2/pages/821/',
html_url: 'https://openstax.org/'
},
title: 'Home'
},
locale: 'en'
},
title: "We're changing the world, one book at a time!",
header_text: 'Check out our interactive map',
section_1_cards: [
{
type: 'card',
value: {
image: {
image: 661,
alt_text: '',
link: '',
alignment: 'left',
identifier: ''
},
number: '9',
unit: 'million',
description: 'students have used OpenStax textbooks'
},
id: 'bf261a46-e88f-408f-9521-5540764b0b94'
},
{
type: 'card',
value: {
image: {
image: 662,
alt_text: '',
link: '',
alignment: 'left',
identifier: ''
},
number: '56',
unit: '%',
description:
'of degree-granting institutions in the US use OpenStax'
},
id: 'e9759079-5b69-4b17-ab50-fd9faddfed46'
},
{
type: 'card',
value: {
image: {
image: 663,
alt_text: '',
link: '',
alignment: 'left',
identifier: ''
},
number: '$835',
unit: 'million',
description: 'saved by students since 2012'
},
id: 'f01a5792-91f2-431b-92fb-9d780b4c43e3'
},
{
type: 'card',
value: {
image: {
image: 664,
alt_text: '',
link: '',
alignment: 'left',
identifier: ''
},
number: '7,000',
unit: '+',
description: 'schools use OpenStax'
},
id: '56540272-83d5-4273-b389-67fabc766f95'
}
],
map_image_url:
'https://assets.openstax.org/oscms-prodcms/media/original_images/global-map.original.original.jpg',
section_2_header_1: 'Ready to join the OpenStax movement?',
section_2_blurb_1:
"We’re proud of how far we’ve come, but we need YOU to continue our mission of increasing student access to education. Let us know you're using OpenStax and put your school on the map!",
section_2_cta_1: "I'm using OpenStax",
section_2_link_1: 'https://openstax.org/adoption',
section_2_image_1_url:
'https://assets.openstax.org/oscms-prodcms/media/original_images/girl.png',
section_2_header_2: 'Want to help?',
section_2_blurb_2:
'OpenStax is part of Rice University which is a 501(c)(3) nonprofit charitable corporation, which means that we rely on our supporters to grow and expand our library. With your help, we can bring open education resources to even more students across the world.',
section_2_cta_2: 'I want to give',
section_2_link_2: 'https://riceconnect.rice.edu/donation/support-openstax',
section_2_image_2_url:
'https://assets.openstax.org/oscms-prodcms/media/original_images/girl_and_guy.png',
section_3_heading: 'Put your school on the Map',
section_3_blurb:
'Our prestigious Institutional Partner Program provides guidance for increasing the use of open educational resources on your campus.',
section_3_cta: 'I want to learn more',
section_3_link: 'https://openstax.org/institutional-partnership',
promote_image: null
};
15 changes: 15 additions & 0 deletions test/src/pages/global-reach.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import {render, screen} from '@testing-library/preact';
import MemoryRouter from '~/../../test/helpers/future-memory-router';
import GlobalReachLoader from '~/pages/global-reach/global-reach';

describe('global-reach page', () => {
it('renders', async () => {
render(
<MemoryRouter initialEntries={['/global-reach']}>
<GlobalReachLoader />
</MemoryRouter>
);
await screen.findByRole('heading', {level: 1});
});
});