Skip to content

Commit 2bdc269

Browse files
feat: Add Dependabot configuration for GitHub Actions and npm updates; update action versions in workflows
1 parent 7c551dd commit 2bdc269

File tree

6 files changed

+61
-77
lines changed

6 files changed

+61
-77
lines changed

.github/dependabot.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
groups:
8+
actions-minor:
9+
update-types:
10+
- minor
11+
- patch
12+
13+
- package-ecosystem: npm
14+
directory: /
15+
schedule:
16+
interval: weekly
17+
groups:
18+
npm-development:
19+
dependency-type: development
20+
update-types:
21+
- minor
22+
- patch
23+
npm-production:
24+
dependency-type: production
25+
update-types:
26+
- patch

.github/workflows/attestations.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616
steps:
1717
# Checkout the repository
1818
- name: Checkout repository
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
2020

2121
# Install dependencies
2222
- name: Install dependencies
2323
run: npm install
2424

2525
# Generate SBOM from the dependencies (scanning the workspace directory)
2626
- name: Generate SBOM
27-
uses: anchore/sbom-action@v0
27+
uses: anchore/sbom-action@9f7302141466aa6482940f15371237e9d9f4c34a
2828
with:
2929
upload-artifact: false
3030
upload-release-assets: false
@@ -46,14 +46,14 @@ jobs:
4646
# subject-path: "dist.tar.gz"
4747

4848
# Complete an attestation of the SBOM and the build
49-
- uses: actions/attest-sbom@v1
49+
- uses: actions/attest-sbom@115c3be05ff3974bcbd596578934b3f9ce39bf68
5050
with:
5151
subject-path: 'dist.tar.gz'
5252
sbom-path: 'sbom.spdx.json'
5353

5454
# Publish the SBOM (Zipped per https://github.com/actions/upload-artifact?tab=readme-ov-file#zip-archives)
5555
- name: Publish the SBOM
56-
uses: actions/upload-artifact@v4
56+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
5757
with:
5858
name: sbom
5959
path: sbom.spdx.json
@@ -66,7 +66,7 @@ jobs:
6666
# path: dist.tar.gz
6767

6868
- name: "Deploy to GitHub Pages"
69-
uses: actions/upload-pages-artifact@v3.0.1
69+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa
7070
with:
7171
path: dist
7272

@@ -90,4 +90,4 @@ jobs:
9090
steps:
9191
- name: Deploy to GitHub Pages
9292
id: deployment
93-
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
93+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # or specific "vX.X.X" version tag for this action

src/features/lists/components/ListAddTask.test.jsx

Lines changed: 7 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,13 @@ import ListAddTask from './ListAddTask';
55

66
// Mock the context hooks
77
const mockAddTask = vi.fn();
8-
const mockAddTag = vi.fn();
98

109
vi.mock('../../../context/TaskContext', () => ({
1110
useTaskContext: () => ({
1211
addTask: mockAddTask
1312
})
1413
}));
1514

16-
vi.mock('../../../context/TagContext', () => ({
17-
useTagContext: () => ({
18-
tags: ['work', 'personal', 'urgent'],
19-
addTag: mockAddTag
20-
})
21-
}));
22-
2315
describe('ListAddTask Component', () => {
2416
const mockOnCancel = vi.fn();
2517
const mockListFilters = [
@@ -28,16 +20,14 @@ describe('ListAddTask Component', () => {
2820

2921
beforeEach(() => {
3022
mockAddTask.mockClear();
31-
mockAddTag.mockClear();
3223
mockOnCancel.mockClear();
3324
});
3425

3526
test('renders the form correctly', () => {
3627
render(<ListAddTask onCancel={mockOnCancel} listFilters={mockListFilters} />);
3728

38-
expect(screen.getByTestId('list-add-task')).toBeInTheDocument();
29+
expect(screen.getByTestId('list-add-task-form')).toBeInTheDocument();
3930
expect(screen.getByTestId('list-task-input')).toBeInTheDocument();
40-
expect(screen.getByTestId('list-tag-input')).toBeInTheDocument();
4131
expect(screen.getByTestId('list-cancel-button')).toBeInTheDocument();
4232
expect(screen.getByTestId('list-submit-button')).toBeInTheDocument();
4333
});
@@ -51,63 +41,29 @@ describe('ListAddTask Component', () => {
5141
expect(taskInput.value).toBe('New Test Task');
5242
});
5343

54-
test('handles tag input change', () => {
55-
render(<ListAddTask onCancel={mockOnCancel} listFilters={mockListFilters} />);
56-
57-
const tagInput = screen.getByTestId('list-tag-input');
58-
fireEvent.change(tagInput, { target: { value: 'personal' } });
59-
60-
expect(tagInput.value).toBe('personal');
61-
});
62-
63-
test('includes tags from list filters by default', () => {
44+
test('displays auto-applied tags from list filters', () => {
6445
render(<ListAddTask onCancel={mockOnCancel} listFilters={mockListFilters} />);
6546

66-
expect(screen.getByTestId('list-selected-tags')).toBeInTheDocument();
67-
expect(screen.getByText('work')).toBeInTheDocument();
47+
expect(screen.getByTestId('auto-applied-tags')).toBeInTheDocument();
48+
expect(screen.getByText(/will be tagged with/i)).toBeInTheDocument();
49+
expect(screen.getByText(/work/i)).toBeInTheDocument();
6850
});
6951

70-
test('adds a tag when Enter key is pressed', () => {
71-
render(<ListAddTask onCancel={mockOnCancel} listFilters={mockListFilters} />);
72-
73-
const tagInput = screen.getByTestId('list-tag-input');
74-
fireEvent.change(tagInput, { target: { value: 'new-tag' } });
75-
fireEvent.keyDown(tagInput, { key: 'Enter' });
76-
77-
expect(screen.getByText('new-tag')).toBeInTheDocument();
78-
expect(tagInput.value).toBe('');
79-
});
80-
81-
test('removes a tag when remove button is clicked', () => {
82-
render(<ListAddTask onCancel={mockOnCancel} listFilters={mockListFilters} />);
83-
84-
const tagToRemove = screen.getByText('work');
85-
const removeButton = screen.getByTestId('list-remove-tag-work');
86-
fireEvent.click(removeButton);
87-
88-
expect(screen.queryByText('work')).not.toBeInTheDocument();
89-
});
90-
91-
test('submits the form with task and tags', () => {
52+
test('submits the form with task and tags from list filters', () => {
9253
render(<ListAddTask onCancel={mockOnCancel} listFilters={mockListFilters} />);
9354

9455
// Fill in task
9556
const taskInput = screen.getByTestId('list-task-input');
9657
fireEvent.change(taskInput, { target: { value: 'Submit Test Task' } });
9758

98-
// Add another tag
99-
const tagInput = screen.getByTestId('list-tag-input');
100-
fireEvent.change(tagInput, { target: { value: 'urgent' } });
101-
fireEvent.keyDown(tagInput, { key: 'Enter' });
102-
10359
// Submit the form
10460
const submitButton = screen.getByTestId('list-submit-button');
10561
fireEvent.click(submitButton);
10662

10763
expect(mockAddTask).toHaveBeenCalledWith({
10864
text: 'Submit Test Task',
10965
isCompleted: false,
110-
tags: ['work', 'urgent']
66+
tags: ['work']
11167
});
11268
expect(mockOnCancel).toHaveBeenCalled();
11369
});

src/features/lists/components/TaskListConfig.test.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import { render, screen, fireEvent } from '@testing-library/react';
33
import { vi } from 'vitest';
44
import TaskListConfig from './TaskListConfig';
55

6-
// Mock the tag context
7-
const mockTags = ['work', 'personal', 'urgent', 'home'];
6+
// Mock variables to control the mocked context values
7+
let mockTagsValue = ['work', 'personal', 'urgent', 'home'];
88

9+
// Mock the tag context
910
vi.mock('../../../context/TagContext', () => ({
1011
useTagContext: () => ({
11-
tags: mockTags
12+
tags: mockTagsValue
1213
})
1314
}));
1415

@@ -27,6 +28,8 @@ describe('TaskListConfig Component', () => {
2728
beforeEach(() => {
2829
mockOnSave.mockClear();
2930
mockOnCancel.mockClear();
31+
// Reset the mock tags to the default value before each test
32+
mockTagsValue = ['work', 'personal', 'urgent', 'home'];
3033
});
3134

3235
test('renders the task list config correctly', () => {
@@ -189,9 +192,8 @@ describe('TaskListConfig Component', () => {
189192
});
190193

191194
test('displays message when no tags are available', () => {
192-
vi.spyOn(require('../../../context/TagContext'), 'useTagContext').mockReturnValue({
193-
tags: []
194-
});
195+
// Set mock tags to an empty array for this test
196+
mockTagsValue = [];
195197

196198
render(
197199
<TaskListConfig

src/features/tags/components/TagManager.test.jsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ const mockDeleteTag = vi.fn();
1010
const mockUpdateTasksWithEditedTag = vi.fn();
1111
const mockUpdateTasksWithDeletedTag = vi.fn();
1212

13+
// Mock data to control context values in tests
14+
let mockTagsValue = ['work', 'personal', 'urgent'];
15+
1316
vi.mock('../../../context/TagContext', () => ({
1417
useTagContext: () => ({
15-
tags: ['work', 'personal', 'urgent'],
18+
tags: mockTagsValue,
1619
addTag: mockAddTag,
1720
editTag: mockEditTag,
1821
deleteTag: mockDeleteTag
@@ -36,6 +39,8 @@ describe('TagManager Component', () => {
3639
mockUpdateTasksWithEditedTag.mockClear();
3740
mockUpdateTasksWithDeletedTag.mockClear();
3841
mockOnClose.mockClear();
42+
// Reset the mock tags to the default value before each test
43+
mockTagsValue = ['work', 'personal', 'urgent'];
3944
});
4045

4146
test('renders the tag manager correctly', () => {
@@ -137,12 +142,8 @@ describe('TagManager Component', () => {
137142
});
138143

139144
test('renders no tags message when there are no tags', () => {
140-
vi.spyOn(require('../../../context/TagContext'), 'useTagContext').mockReturnValue({
141-
tags: [],
142-
addTag: mockAddTag,
143-
editTag: mockEditTag,
144-
deleteTag: mockDeleteTag
145-
});
145+
// Set mock tags to an empty array for this test
146+
mockTagsValue = [];
146147

147148
render(<TagManager onClose={mockOnClose} />);
148149

src/setupTests.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import React from 'react';
12
import { expect, vi, afterEach } from 'vitest';
23
import { cleanup } from '@testing-library/react';
3-
import matchers from '@testing-library/jest-dom/matchers';
4+
import * as matchers from '@testing-library/jest-dom/matchers';
45

56
// Add custom jest-dom matchers
67
expect.extend(matchers);
@@ -12,14 +13,12 @@ afterEach(() => {
1213

1314
// Mock framer-motion to avoid animation-related test issues
1415
vi.mock('framer-motion', () => {
15-
const actual = vi.importActual('framer-motion');
1616
return {
17-
...actual,
1817
motion: {
19-
div: ({ children, ...props }) => <div {...props}>{children}</div>,
20-
button: ({ children, ...props }) => <button {...props}>{children}</button>,
21-
p: ({ children, ...props }) => <p {...props}>{children}</p>,
18+
div: ({ children, ...props }) => React.createElement('div', props, children),
19+
button: ({ children, ...props }) => React.createElement('button', props, children),
20+
p: ({ children, ...props }) => React.createElement('p', props, children)
2221
},
23-
AnimatePresence: ({ children }) => <>{children}</>,
22+
AnimatePresence: ({ children }) => children,
2423
};
2524
});

0 commit comments

Comments
 (0)