Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Trim unit test

ZachTRice901279c47308
diff --git a/web/js/tour/model.test.js b/web/js/tour/model.test.js
index 0d60ca1f5..fecf64bbc 100644
--- a/web/js/tour/model.test.js
+++ b/web/js/tour/model.test.js
@@ -4,30 +4,7 @@ function testConfig() {
return {
stories: {
test_story_01: {
- backgroundImage: 'background.png',
- backgroundImageHover: 'background-hover.png',
- description: 'A story description',
- id: 'test_story_01',
- readMoreLinks: [
- {
- link: 'https://worldview.earthdata.nasa.gov',
- title: 'NASA Worldview'
- }
- ],
- steps: [
- {
- description: 'step001.html',
- id: '001',
- stepLink: 'p=geographic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Labels,Reference_Features,Coastlines(hidden)&t=2018-08-17-T00%3A00%3A00Z&z=3&v=-150.90029967594097,27.400561971879853,-83.40029967594097,60.37712447187985',
- transition:
- {
- action: '',
- element: ''
- }
- }
- ],
- title: 'The test story title',
- type: 'wildfire'
+ id: 'test_story_01'
}
},
storyOrder: [
@@ -38,20 +15,11 @@ function testConfig() {
};
};
-test('throws exception when loading an invalid tour', () => {
- let model = tourModel(testConfig());
- let state = {
- 'tr': 'test_story_01'
- };
- model.load(state);
- expect(() => tourModel(model)).toThrow();
-});
-
test('selects tour', () => {
let model = tourModel(testConfig());
let listener = jest.fn();
model.events.on('select', listener);
- model.select('arctic');
+ model.select('test_story_01');
expect(model.selected.id).toBe('test_story_01');
expect(listener).toBeCalled();
});
@@ -59,8 +27,10 @@ test('selects tour', () => {
test('saves state', () => {
let model = tourModel(testConfig());
let state = {};
+ model.toggle();
+ model.select('test_story_01');
model.save(state);
- expect(state.p).toBe('test_story_01');
+ expect(state.tr).toBe('test_story_01');
});
test('loads state', () => {