Skip to content

Commit

Permalink
refactor: 💡 remove IsWet for NominalCode: 'NOT_WEB'
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskaransarkaria committed Jan 30, 2022
1 parent c9b1c76 commit 36407f3
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .routify/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ module.exports = {
noHashScroll: false,
distDir: 'dist',
extensions: ['svelte', 'html', 'svx', 'md'],
started: '2022-01-29T16:17:06.229Z',
started: '2022-01-30T16:53:13.676Z',
};
4 changes: 2 additions & 2 deletions .routify/routes.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* @roxi/routify 2.7.3
* File generated Sat Jan 29 2022 16:17:08 GMT+0000 (Greenwich Mean Time)
* File generated Sun Jan 30 2022 16:53:16 GMT+0000 (Greenwich Mean Time)
*/

export const __version = '2.7.3';
export const __timestamp = '2022-01-29T16:17:08.822Z';
export const __timestamp = '2022-01-30T16:53:16.650Z';

//buildRoutes
import { buildClientTree } from '@roxi/routify/runtime/buildRoutes';
Expand Down
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

<link rel='icon' type='image/png' href='/favicon.png'>
<link rel='stylesheet' href='/global.css'>
<link rel='stylesheet' href='/build/bundle-1643473026228.css'>
<link rel='stylesheet' href='/build/bundle-1643561593674.css'>

<script defer src='/build/bundle-1643473026228.js'></script>
<script defer src='/build/bundle-1643561593674.js'></script>
</head>
<body>
</body>
Expand Down
16 changes: 5 additions & 11 deletions src/components/CategoryView/CategoryView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ const nestedCategories = {
ParentId: null,
Name: '',
NominalCode: 'TRUE',
IsWet: false,

Children: [
{
Id: 123,
ParentId: null,
Name: 'Clothes',
NominalCode: 'TRUE',
IsWet: false,

Children: [
{
Id: 456,
ParentId: null,
Name: 'Shoes',
NominalCode: 'TRUE',
IsWet: false,

Children: [
{
Id: 789,
ParentId: null,
Name: 'Hats',
NominalCode: 'TRUE',
IsWet: false,

Children: [],
},
],
Expand Down Expand Up @@ -68,7 +68,6 @@ describe('GIVEN CategoryView', () => {
Name: '',
Children: [],
NominalCode: '',
IsWet: false,
});
});
});
Expand All @@ -81,7 +80,6 @@ describe('GIVEN CategoryView', () => {
Name: 'Clothes',
Children: [],
NominalCode: 'TRUE',
IsWet: false,
});

render(CategoryView, {
Expand All @@ -95,7 +93,6 @@ describe('GIVEN CategoryView', () => {
Name: 'Clothes',
Children: [],
NominalCode: 'TRUE',
IsWet: false,
});
expect(refreshCategory).toHaveBeenCalledTimes(0);
expect(screen.getByRole('heading')).toHaveTextContent('123');
Expand All @@ -110,7 +107,6 @@ describe('GIVEN CategoryView', () => {
Name: 'Shoes',
Children: [],
NominalCode: 'TRUE',
IsWet: false,
},
]);

Expand All @@ -125,7 +121,6 @@ describe('GIVEN CategoryView', () => {
Name: '',
Children: [],
NominalCode: '',
IsWet: false,
});
expect(refreshCategory).toHaveBeenCalledTimes(1);
await tick(); // using tick helps to flush any state changes in the component
Expand All @@ -137,7 +132,6 @@ describe('GIVEN CategoryView', () => {
ParentId: null,
Children: [],
NominalCode: 'TRUE',
IsWet: false,
});
expect(screen.getByRole('heading')).toHaveTextContent('456');
cleanup();
Expand Down Expand Up @@ -177,7 +171,7 @@ describe('GIVEN CategoryView', () => {
Name: 'Variant',
ParentId: null,
Children: [],
IsWet: false,

NominalCode: '',
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/HexGrid/HexGrid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<ul class={showGrid ? 'root-categories-container' : 'flexbox-container'}>
{#each data as category, idx (category.Id)}
{#if isTag(category) || (isCategory(category) && category.IsWet === false)}
{#if isTag(category) || (isCategory(category) && category.NominalCode !== 'NOT_WEB')}
<li class={showGrid ? 'hex' : 'hex-flex'}>
<div class="hex-in">
<div class={loadedElemArr[idx] ? 'hex-link' : 'hex-link hex-loading'}>
Expand Down
5 changes: 2 additions & 3 deletions src/components/HexGrid/HexGrid.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const mockData: Category[] = [
ParentId: null,
Children: [],
NominalCode: '',
IsWet: false,
},
];

Expand Down Expand Up @@ -45,11 +44,11 @@ describe('GIVEN HexGrid', () => {
);
});

it("AND IsWet property is 'true' THEN do not render that hexagon", () => {
it("AND NominalCode property is 'NOT_WEB' THEN do not render that hexagon", () => {
render(HexGrid, {
data: [
...mockData,
{ ...mockData[0], Id: 456, IsWet: true, Name: 'Dog' },
{ ...mockData[0], Id: 456, NominalCode: 'NOT_WEB', Name: 'Dog' },
],
});
expect(screen.queryByTestId('loading-spinner')).not.toBeInTheDocument();
Expand Down
6 changes: 3 additions & 3 deletions src/components/RootCategories/RootCategories.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('GIVEN RootCategories', () => {
ParentId: -1,
Name: 'Clothes',
Children: [],
IsWet: false,

NominalCode: '',
},
]);
Expand All @@ -57,15 +57,15 @@ describe('GIVEN RootCategories', () => {
ParentId: -1,
Name: 'Clothes',
Children: [],
IsWet: false,

NominalCode: '',
},
{
Id: 456,
ParentId: -1,
Name: 'Books',
Children: [],
IsWet: false,

NominalCode: '',
},
]);
Expand Down
1 change: 0 additions & 1 deletion src/components/TagView/TagView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const mockData: Category[] = [
ParentId: null,
Children: [],
NominalCode: '',
IsWet: false,
},
];

Expand Down
1 change: 0 additions & 1 deletion src/stores/categories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const initialValue = {
Name: '',
Children: [],
NominalCode: '',
IsWet: false,
};

export const categories = writable<Category>(initialValue);
Expand Down
1 change: 0 additions & 1 deletion src/types/category.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ export interface Category extends Base {
ParentId: number | null;
Children: Category[];
NominalCode: string;
IsWet: boolean;
}
5 changes: 1 addition & 4 deletions src/types/isCategory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import type { Base } from '@/types/base';
import type { Category } from '@/types/category';

const isCategory = (obj: Base): obj is Category =>
'IsWet' in obj &&
'ParentId' in obj &&
'Children' in obj &&
'NominalCode' in obj;
'ParentId' in obj && 'Children' in obj && 'NominalCode' in obj;

export default isCategory;

0 comments on commit 36407f3

Please sign in to comment.