Comments (3)
@noahtalerman I am not totally clear on how importing assets in JS works. Would this approach (1) actually check that the contents of the img
tag match the source file?
from fleet.
Would this approach (1) actually check that the contents of the img tag match the source file?
I believe yes.
import React from 'react';
import {shallow} from 'enzyme';
import Logo from "./../Logo";
import logoImage from "./../../../assets/images/logo.png;
describe("<Logo />", () => {
it("renders an image", () => {
const logo = shallow(<Logo />);
expect(logo.find("img").prop("src")).toEqual(logoImage);
});
});
Approach (1) is inspired by the example code above. In the example, one image asset is imported and used to check one img
tag. Approach (1) builds on this idea by creating a grouping of all possible (expected) assets and then checking that the src
of each img
tag is included in the grouping.
I'm not yet clear on the details of Jest's .toHaveProperty()
.
from fleet.
From Slack:
After more thinking, I’m flipping on my decision to write unit tests to check that all
img
tags have a source that doesn’t 404.
I think if I wrote the tests now, they would require a decent amount of upkeep when we make further changes to icons in the front end code. To me, it now makes more sense to include tests for broken images when we tackle end to end testing.
For now, instead of writing the unit tests, I’m going to spend 30-60 min QAing the front end to make sure there are no broken images or additional bugs. I’ll be performing a similar QA pass before each release.
from fleet.
Related Issues (20)
- Periodically check hosts that need the DDM declaration for software update and send it HOT 1
- When config for software update change, update the team/noteam DDM declaration. HOT 1
- Additional "healthz" data HOT 2
- AWS EC2 info host details page HOT 3
- UI missing style for host name in ran script activity item HOT 1
- Customer request: Cancel self-service HOT 1
- Fleet in your calendar - Configuration changes
- Fleet in your calendar - Calendar interface
- Fleet in your calendar - Cron job, osquery policy results, webhook
- Fleet in your calendar - Clean up job
- Fleet in your calendar - Mock Google calendar
- Fleet in your calendar - Configuration UI
- Fleet in your calendar - Calendar events modal
- Release QA: 4.46.3
- [QA Wolf] OS updates page missing OS Type, Current Version, and Number of Hosts data
- Release QA: 4.46.3
- Software title detail page: Software usage stats
- Perform bulk host operations based on any filter criteria HOT 2
- Prevent Unexpected Bulk Host Actions
- Website bug: (docs) Content in code blocks nested in ordered lists has incorrect indentation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fleet.