Skip to content

Commit

Permalink
Update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomejerry committed Jul 5, 2018
1 parent 8266091 commit 7b2dbe3
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 43 deletions.
41 changes: 37 additions & 4 deletions src/__mocks__/react-native-svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,47 @@ export default function ({ children }) {
)
}

export const Rect = () => {
export const Rect = (props) => {
return (
<span>Rect</span>
<span>Rect: {JSON.stringify(props)}</span>
)
}

export const Path = () => {
export const Path = (props) => {
return (
<span>Path</span>
<span>Path: {JSON.stringify(props)}</span>
)
}

export const G = ({ children, ...props }) => {
return (
<span>
G: {JSON.stringify(props)}
children: {children}
</span>
)
}

export const Defs = ({ children, ...props }) => {
return (
<span>
Defs: {JSON.stringify(props)}
children: {children}
</span>
)
}

export const Image = (props) => {
return (
<span>Image: {JSON.stringify(props)}</span>
)
}

export const ClipPath = ({ children, ...props }) => {
return (
<span>
ClipPath: {JSON.stringify(props)}
children: {children}
</span>
)
}
31 changes: 9 additions & 22 deletions src/__mocks__/react-native.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
import React from 'react'
import PropTypes from 'prop-types'

export const View = ({ children }) => {
return (
<div>{children}</div>
)
}

export const Image = ({ source, resizeMode }) => {
return (
<div>
<span>Source: {source.uri ? source.uri : source}</span>
<span>ResizeMode: {resizeMode}</span>
</div>
)
}
Image.propTypes = {
source: PropTypes.oneOfType([
PropTypes.number,
PropTypes.shape({
uri: PropTypes.string
})
])
export const Image = {
propTypes: {
source: PropTypes.oneOfType([
PropTypes.number,
PropTypes.shape({
uri: PropTypes.string
})
])
}
}
86 changes: 69 additions & 17 deletions src/__tests__/__snapshots__/QRCode-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,90 @@

exports[`QRCode renders correctly 1`] = `
<div>
<div>
<span>
Defs:
{}
children:
<span>
Rect
ClipPath:
{"id":"clip-wrapper"}
children:
<span>
Rect:
{"width":24,"height":24,"rx":0,"ry":0}
</span>
</span>
<span>
Path
ClipPath:
{"id":"clip-logo"}
children:
<span>
Rect:
{"width":20,"height":20,"rx":0,"ry":0}
</span>
</span>
</div>
</span>
<span>
Rect:
{"width":100,"height":100,"fill":"white"}
</span>
<span>
Path:
{"d":"M0 2 L28 2 M52 2 L68 2 M72 2 L100 2 M0 6 L4 6 M24 6 L28 6 M32 6 L36 6 M44 6 L48 6 M56 6 L68 6 M72 6 L76 6 M96 6 L100 6 M0 10 L4 10 M8 10 L20 10 M24 10 L28 10 M44 10 L52 10 M56 10 L60 10 M72 10 L76 10 M80 10 L92 10 M96 10 L100 10 M0 14 L4 14 M8 14 L20 14 M24 14 L28 14 M40 14 L48 14 M52 14 L56 14 M60 14 L64 14 M72 14 L76 14 M80 14 L92 14 M96 14 L100 14 M0 18 L4 18 M8 18 L20 18 M24 18 L28 18 M32 18 L36 18 M40 18 L64 18 M72 18 L76 18 M80 18 L92 18 M96 18 L100 18 M0 22 L4 22 M24 22 L28 22 M36 22 L44 22 M48 22 L52 22 M56 22 L64 22 M72 22 L76 22 M96 22 L100 22 M0 26 L28 26 M32 26 L36 26 M40 26 L44 26 M48 26 L52 26 M56 26 L60 26 M64 26 L68 26 M72 26 L100 26 M36 30 L48 30 M60 30 L68 30 M0 34 L4 34 M8 34 L12 34 M16 34 L20 34 M24 34 L28 34 M44 34 L48 34 M64 34 L68 34 M80 34 L84 34 M92 34 L96 34 M4 38 L12 38 M32 38 L56 38 M64 38 L80 38 M84 38 L100 38 M0 42 L8 42 M12 42 L16 42 M24 42 L36 42 M40 42 L44 42 M56 42 L60 42 M72 42 L100 42 M0 46 L4 46 M8 46 L16 46 M28 46 L36 46 M40 46 L44 46 M52 46 L60 46 M64 46 L72 46 M76 46 L80 46 M92 46 L96 46 M8 50 L16 50 M20 50 L32 50 M40 50 L48 50 M56 50 L76 50 M84 50 L88 50 M4 54 L20 54 M28 54 L32 54 M44 54 L48 54 M56 54 L60 54 M64 54 L68 54 M84 54 L88 54 M92 54 L100 54 M0 58 L4 58 M8 58 L16 58 M24 58 L28 58 M32 58 L44 58 M52 58 L56 58 M72 58 L76 58 M80 58 L88 58 M92 58 L100 58 M4 62 L8 62 M16 62 L24 62 M44 62 L48 62 M76 62 L80 62 M84 62 L88 62 M92 62 L96 62 M0 66 L4 66 M8 66 L40 66 M48 66 L52 66 M64 66 L84 66 M92 66 L100 66 M32 70 L36 70 M44 70 L56 70 M60 70 L68 70 M80 70 L88 70 M0 74 L28 74 M44 74 L52 74 M56 74 L60 74 M64 74 L68 74 M72 74 L76 74 M80 74 L84 74 M88 74 L100 74 M0 78 L4 78 M24 78 L28 78 M40 78 L44 78 M48 78 L60 78 M64 78 L68 78 M80 78 L84 78 M92 78 L100 78 M0 82 L4 82 M8 82 L20 82 M24 82 L28 82 M32 82 L36 82 M40 82 L48 82 M56 82 L60 82 M64 82 L84 82 M96 82 L100 82 M0 86 L4 86 M8 86 L20 86 M24 86 L28 86 M36 86 L40 86 M44 86 L48 86 M56 86 L64 86 M76 86 L92 86 M0 90 L4 90 M8 90 L20 90 M24 90 L28 90 M32 90 L40 90 M52 90 L56 90 M64 90 L76 90 M80 90 L92 90 M96 90 L100 90 M0 94 L4 94 M24 94 L28 94 M36 94 L48 94 M60 94 L72 94 M80 94 L84 94 M92 94 L96 94 M0 98 L28 98 M32 98 L36 98 M40 98 L44 98 M48 98 L52 98 M64 98 L68 98 M80 98 L88 98 M92 98 L100 98 ","stroke":"black","strokeWidth":4}
</span>
</div>
`;

exports[`QRCode renders with logo correctly 1`] = `
<div>
<div>
<span>
Defs:
{}
children:
<span>
Rect
ClipPath:
{"id":"clip-wrapper"}
children:
<span>
Rect:
{"width":24,"height":24,"rx":0,"ry":0}
</span>
</span>
<span>
Path
</span>
</div>
<div>
<div>
ClipPath:
{"id":"clip-logo"}
children:
<span>
Source:
fakeUri
Rect:
{"width":20,"height":20,"rx":0,"ry":0}
</span>
</span>
</span>
<span>
Rect:
{"width":100,"height":100,"fill":"white"}
</span>
<span>
Path:
{"d":"M0 2 L28 2 M52 2 L68 2 M72 2 L100 2 M0 6 L4 6 M24 6 L28 6 M32 6 L36 6 M44 6 L48 6 M56 6 L68 6 M72 6 L76 6 M96 6 L100 6 M0 10 L4 10 M8 10 L20 10 M24 10 L28 10 M44 10 L52 10 M56 10 L60 10 M72 10 L76 10 M80 10 L92 10 M96 10 L100 10 M0 14 L4 14 M8 14 L20 14 M24 14 L28 14 M40 14 L48 14 M52 14 L56 14 M60 14 L64 14 M72 14 L76 14 M80 14 L92 14 M96 14 L100 14 M0 18 L4 18 M8 18 L20 18 M24 18 L28 18 M32 18 L36 18 M40 18 L64 18 M72 18 L76 18 M80 18 L92 18 M96 18 L100 18 M0 22 L4 22 M24 22 L28 22 M36 22 L44 22 M48 22 L52 22 M56 22 L64 22 M72 22 L76 22 M96 22 L100 22 M0 26 L28 26 M32 26 L36 26 M40 26 L44 26 M48 26 L52 26 M56 26 L60 26 M64 26 L68 26 M72 26 L100 26 M36 30 L48 30 M60 30 L68 30 M0 34 L4 34 M8 34 L12 34 M16 34 L20 34 M24 34 L28 34 M44 34 L48 34 M64 34 L68 34 M80 34 L84 34 M92 34 L96 34 M4 38 L12 38 M32 38 L56 38 M64 38 L80 38 M84 38 L100 38 M0 42 L8 42 M12 42 L16 42 M24 42 L36 42 M40 42 L44 42 M56 42 L60 42 M72 42 L100 42 M0 46 L4 46 M8 46 L16 46 M28 46 L36 46 M40 46 L44 46 M52 46 L60 46 M64 46 L72 46 M76 46 L80 46 M92 46 L96 46 M8 50 L16 50 M20 50 L32 50 M40 50 L48 50 M56 50 L76 50 M84 50 L88 50 M4 54 L20 54 M28 54 L32 54 M44 54 L48 54 M56 54 L60 54 M64 54 L68 54 M84 54 L88 54 M92 54 L100 54 M0 58 L4 58 M8 58 L16 58 M24 58 L28 58 M32 58 L44 58 M52 58 L56 58 M72 58 L76 58 M80 58 L88 58 M92 58 L100 58 M4 62 L8 62 M16 62 L24 62 M44 62 L48 62 M76 62 L80 62 M84 62 L88 62 M92 62 L96 62 M0 66 L4 66 M8 66 L40 66 M48 66 L52 66 M64 66 L84 66 M92 66 L100 66 M32 70 L36 70 M44 70 L56 70 M60 70 L68 70 M80 70 L88 70 M0 74 L28 74 M44 74 L52 74 M56 74 L60 74 M64 74 L68 74 M72 74 L76 74 M80 74 L84 74 M88 74 L100 74 M0 78 L4 78 M24 78 L28 78 M40 78 L44 78 M48 78 L60 78 M64 78 L68 78 M80 78 L84 78 M92 78 L100 78 M0 82 L4 82 M8 82 L20 82 M24 82 L28 82 M32 82 L36 82 M40 82 L48 82 M56 82 L60 82 M64 82 L84 82 M96 82 L100 82 M0 86 L4 86 M8 86 L20 86 M24 86 L28 86 M36 86 L40 86 M44 86 L48 86 M56 86 L64 86 M76 86 L92 86 M0 90 L4 90 M8 90 L20 90 M24 90 L28 90 M32 90 L40 90 M52 90 L56 90 M64 90 L76 90 M80 90 L92 90 M96 90 L100 90 M0 94 L4 94 M24 94 L28 94 M36 94 L48 94 M60 94 L72 94 M80 94 L84 94 M92 94 L96 94 M0 98 L28 98 M32 98 L36 98 M40 98 L44 98 M48 98 L52 98 M64 98 L68 98 M80 98 L88 98 M92 98 L100 98 ","stroke":"black","strokeWidth":4}
</span>
<span>
G:
{"x":38,"y":38}
children:
<span>
Rect:
{"width":24,"height":24,"fill":"white","clipPath":"url(#clip-wrapper)"}
</span>
<span>
G:
{"x":2,"y":2}
children:
<span>
ResizeMode:
contain
Image:
{"width":20,"height":20,"preserveAspectRatio":"xMidYMid slice","href":{"uri":"fakeUri"},"clipPath":"url(#clip-logo)"}
</span>
</div>
</div>
</span>
</span>
</div>
`;

0 comments on commit 7b2dbe3

Please sign in to comment.