@pingux/astro 1.33.1 → 1.34.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,87 @@
1
+ import { renderHook } from '@testing-library/react-hooks';
2
+ import useTShirtSize from './useTShirtSize';
3
+ describe('useTShirtSize', function () {
4
+ beforeEach(function () {
5
+ process.env.NODE_ENV = 'development';
6
+
7
+ global.console.warn = function () {
8
+ return jest.mock();
9
+ }; // eslint-disable-line no-console
10
+
11
+ });
12
+ afterEach(function () {
13
+ process.env.NODE_ENV = 'test';
14
+ jest.clearAllMocks();
15
+ });
16
+ test('default', function () {
17
+ var props = {};
18
+ var spy = jest.spyOn(console, 'warn');
19
+ expect(spy).toHaveBeenCalledTimes(0);
20
+ renderHook(function () {
21
+ return useTShirtSize(props);
22
+ });
23
+ expect(spy).toHaveBeenCalledTimes(1);
24
+ });
25
+ });
26
+ test('does not warn if size prop does exist', function () {
27
+ var props = {
28
+ size: 15
29
+ };
30
+ var spy = jest.spyOn(console, 'warn');
31
+ expect(spy).not.toHaveBeenCalled();
32
+ renderHook(function () {
33
+ return useTShirtSize(props);
34
+ });
35
+ expect(spy).not.toHaveBeenCalled();
36
+ });
37
+ test('returns size value if size is a tshirt value', function () {
38
+ var props = {
39
+ size: 'xs'
40
+ };
41
+
42
+ var _renderHook = renderHook(function () {
43
+ return useTShirtSize(props);
44
+ }),
45
+ result = _renderHook.result;
46
+
47
+ var obj = {
48
+ sizeProps: {
49
+ size: '15px'
50
+ }
51
+ };
52
+ expect(result.current).toEqual(obj);
53
+ });
54
+ test('returns size value if size is a string value', function () {
55
+ var props = {
56
+ size: '20px'
57
+ };
58
+
59
+ var _renderHook2 = renderHook(function () {
60
+ return useTShirtSize(props);
61
+ }),
62
+ result = _renderHook2.result;
63
+
64
+ var obj = {
65
+ sizeProps: {
66
+ size: '20px'
67
+ }
68
+ };
69
+ expect(result.current).toEqual(obj);
70
+ });
71
+ test('returns size value if size is a number value', function () {
72
+ var props = {
73
+ size: 20
74
+ };
75
+
76
+ var _renderHook3 = renderHook(function () {
77
+ return useTShirtSize(props);
78
+ }),
79
+ result = _renderHook3.result;
80
+
81
+ var obj = {
82
+ sizeProps: {
83
+ size: 20
84
+ }
85
+ };
86
+ expect(result.current).toEqual(obj);
87
+ });
@@ -0,0 +1,5 @@
1
+ export var tShirtSizes = {
2
+ xs: 15,
3
+ sm: 20,
4
+ md: 25
5
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.33.1",
3
+ "version": "1.34.0-alpha.1",
4
4
  "description": "PingUX themeable React component library",
5
5
  "repository": {
6
6
  "type": "git",