Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions GoalControllerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
public class GoalControllerTests
{
private readonly FakeCollections collections;

public GoalControllerTests()
{
collections = new();
}

// ...

[Fact]
public async void GetForUser()
{
// Arrange
var goals = collections.GetGoals();
var users = collections.GetUsers();
IGoalsService goalsService = new FakeGoalsService(goals, goals[0]);
IUsersService usersService = new FakeUsersService(users, users[0]);
GoalController controller = new(goalsService, usersService);

// Act
var httpContext = new Microsoft.AspNetCore.Http.DefaultHttpContext();
controller.ControllerContext.HttpContext = httpContext;
var result = await controller.GetForUser(goals[0].UserId!);

// Assert
Assert.NotNull(result);

var index = 0;
foreach (Goal goal in result!)
{
Assert.IsAssignableFrom<Goal>(goal);
Assert.Equal(goals[0].UserId, goal.UserId);
index++;
}
}
}
42 changes: 10 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
"private": true,
"dependencies": {
"@date-io/date-fns": "^1.3.13",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-regular-svg-icons": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
"@fortawesome/react-fontawesome": "^0.1.18",
"@material-ui/core": "^4.12.4",
"@material-ui/pickers": "^3.3.10",
"@reduxjs/toolkit": "^1.5.1",
"@types/emoji-mart": "^3.0.5",
"@types/node": "^17.0.41",
"@types/react": "^16.9.0",
"@types/react-redux": "^7.1.7",
"axios": "^0.27.2",
"css-in-js-media": "^2.0.1",
"date-fns": "^2.28.0",
"emoji-mart": "^3.0.1",
"file-loader": "^6.2.0",
"prettier": "^2.6.2",
"react": "^17.0.2",
Expand Down Expand Up @@ -55,8 +54,8 @@
]
},
"devDependencies": {
"@types/emoji-mart": "^3.0.9",
"@types/emoji-mart": "^3.0.14",
"@types/react-dom": "^18.0.5",
"@types/styled-components": "^5.1.25"
}
}
}
1 change: 1 addition & 0 deletions src/api/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ export async function updateGoal(goalId: string, updatedGoal: Goal): Promise<boo
return false
}
}

2 changes: 2 additions & 0 deletions src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface Account {
accountType: AccountType
applicationId: string
transactionIds: string[]

}

export interface Application {
Expand All @@ -27,6 +28,7 @@ export interface Goal {
accountId: string
transactionIds: string[]
tagIds: string[]
icon?: string
}

export interface Tag {
Expand Down
Loading