Skip to content

Commit 16040c9

Browse files
committed
Test if user has permission to change skill entries
1 parent 0e7c0a7 commit 16040c9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/LinkDotNet.Blog.IntegrationTests/Web/Shared/Skills/SkillTableTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,20 @@ public async Task ShouldAddSkill()
6161
fromRepo.Capability.Should().Be("capability");
6262
fromRepo.ProficiencyLevel.Should().Be(ProficiencyLevel.Expert);
6363
}
64+
65+
[Fact]
66+
public async Task ShouldNotAllowToEditSkillTagsWhenNotAdmin()
67+
{
68+
using var ctx = new TestContext();
69+
var skill = new SkillBuilder().Build();
70+
await Repository.StoreAsync(skill);
71+
ctx.Services.AddScoped<IRepository<Skill>>(_ => Repository);
72+
ctx.Services.AddScoped(_ => Mock.Of<IToastService>());
73+
74+
var cut = ctx.RenderComponent<SkillTable>(p =>
75+
p.Add(s => s.IsAuthenticated, false));
76+
77+
cut.WaitForState(() => cut.FindComponents<SkillTag>().Any());
78+
cut.FindComponent<SkillTag>().Instance.IsAuthenticated.Should().BeFalse();
79+
}
6480
}

0 commit comments

Comments
 (0)