-
-
-
- ✴️
- Apr 23, 2023 - account set up
-
-
-
-
- The F2 account @{@html data.user.username}@{@html data.user.instance} was successfully
- set up within {@html data.user.created_with}
-
-
-
-
-
-
-
+
diff --git a/tests/components/atoms/BlockOrReport.test.ts b/tests/components/atoms/BlockOrReport.test.ts
index aa75d21..93a4a82 100644
--- a/tests/components/atoms/BlockOrReport.test.ts
+++ b/tests/components/atoms/BlockOrReport.test.ts
@@ -1,9 +1,17 @@
import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/svelte';
+import { init, locale, register } from 'svelte-i18n';
import BlockOrReport from '../../../src/lib/components/atoms/BlockOrReport.svelte';
+import enMessages from '../../../src/lib/i18n/locales/en.json';
describe('BlockOrReport.svelte', () => {
+ beforeEach(() => {
+ register('en', () => import('../../../src/lib/i18n/locales/en.json'));
+ init({ fallbackLocale: 'en', initialLocale: 'en' });
+ locale.set('en');
+ });
+
it('should mount', () => {
// Arrange
// Nothing to prepare
@@ -23,7 +31,7 @@ describe('BlockOrReport.svelte', () => {
render(BlockOrReport);
// Assert
- expect(screen.getByText('block')).toBeDefined();
+ expect(screen.getByRole('button', { name: 'block' })).toBeDefined();
});
it('should allow for report', () => {
@@ -34,6 +42,6 @@ describe('BlockOrReport.svelte', () => {
render(BlockOrReport);
// Assert
- expect(screen.getByText('report')).toBeDefined();
+ expect(screen.getByRole('button', { name: 'report' })).toBeDefined();
});
});
diff --git a/tests/components/atoms/DisplayName.test.ts b/tests/components/atoms/DisplayName.test.ts
index 10cf548..a943c5b 100644
--- a/tests/components/atoms/DisplayName.test.ts
+++ b/tests/components/atoms/DisplayName.test.ts
@@ -1,9 +1,17 @@
import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/svelte';
+import { init, locale, register } from 'svelte-i18n';
import DisplayName from '../../../src/lib/components/atoms/DisplayName.svelte';
+import enMessages from '../../../src/lib/i18n/locales/en.json';
describe('DisplayName.svelte', () => {
+ beforeEach(() => {
+ register('en', () => import('../../../src/lib/i18n/locales/en.json'));
+ init({ fallbackLocale: 'en', initialLocale: 'en' });
+ locale.set('en');
+ });
+
it('should mount', () => {
// Arrange
const displayName = 'Jane Doe';
@@ -13,6 +21,7 @@ describe('DisplayName.svelte', () => {
render(DisplayName, { displayName, pronoun });
// Assert
+ expect(screen.getByRole('heading', { level: 1 })).toBeInTheDocument();
expect(screen.getByText(displayName)).toBeInTheDocument();
// Turn into regular expression to respect round brackets
expect(screen.getByText(new RegExp(pronoun))).toBeInTheDocument();
diff --git a/tests/components/pages/ImportProject.test.ts b/tests/components/pages/ImportProject.test.ts
index e84e678..a61a4f6 100644
--- a/tests/components/pages/ImportProject.test.ts
+++ b/tests/components/pages/ImportProject.test.ts
@@ -2,7 +2,7 @@ import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/svelte';
import { init, locale, register } from 'svelte-i18n';
-import ImportProject from '../../../src/lib/components/templates/ImportProject.svelte';
+import ImportProject from '../../../src/lib/components/pages/ImportProject.svelte';
import enMessages from '../../../src/lib/i18n/locales/en.json';
describe('ImportProject.svelte', () => {
@@ -14,10 +14,10 @@ describe('ImportProject.svelte', () => {
it('should mount', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- const { container } = render(ImportProject);
+ const { container } = render(ImportProject, { data });
// Assert
expect(container).toBeTruthy();
@@ -25,10 +25,10 @@ describe('ImportProject.svelte', () => {
it('should have a form', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Assert
expect(screen.getByRole('form')).toBeInTheDocument();
@@ -36,10 +36,10 @@ describe('ImportProject.svelte', () => {
it('should have a h2', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
const h2 = screen.getByRole('heading', { level: 2 });
// Assert
@@ -49,10 +49,10 @@ describe('ImportProject.svelte', () => {
it('should have an intro text', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Assert
expect(screen.getByText(enMessages.page.import_project.intro)).toBeInTheDocument();
@@ -61,10 +61,10 @@ describe('ImportProject.svelte', () => {
describe('name', () => {
it('should have a label', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Turn into regular expression to account for the asterisk
const name = screen.getByLabelText(
@@ -77,10 +77,10 @@ describe('ImportProject.svelte', () => {
it('should have a text input', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
const name = screen.getByPlaceholderText(
enMessages.page.import_project.form.fields.name.placeholder
@@ -94,10 +94,10 @@ describe('ImportProject.svelte', () => {
describe('when empty', () => {
it('should display an error', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Assert
expect(
@@ -110,10 +110,10 @@ describe('ImportProject.svelte', () => {
describe.skip('when filled', () => {
it('should hide the error', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Assert
expect(
@@ -123,10 +123,11 @@ describe('ImportProject.svelte', () => {
it('should show a live updating hint', () => {
// Arrange
+ const data = {};
const value = 'Vervis';
// Act
- render(ImportProject, { value });
+ render(ImportProject, { data, value });
// Assert
expect(screen.getByText(`domain.example/projects/${value}`)).toBeInTheDocument();
@@ -137,10 +138,10 @@ describe('ImportProject.svelte', () => {
describe('description', () => {
it('should have a label', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
const description = screen.getByLabelText(
enMessages.page.import_project.form.fields.description.label
@@ -152,10 +153,10 @@ describe('ImportProject.svelte', () => {
it('should have a textarea', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
const description = screen.getByPlaceholderText(
enMessages.page.import_project.form.fields.description.placeholder
@@ -169,44 +170,10 @@ describe('ImportProject.svelte', () => {
describe('avatar', () => {
it('should have a heading', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
-
- const avatar = screen.getByRole('heading', {
- level: 3,
- name: enMessages.page.import_project.form.avatar
- });
-
- // Assert
- expect(avatar).toBeInTheDocument();
- });
-
- it('should have an upload button', () => {
- // Arrange
- // Nothing to prepare
-
- // Act
- render(ImportProject);
-
- // Turn into regular expression to account for the icon
- const avatar = screen.getByLabelText(
- new RegExp(enMessages.page.import_project.form.fields.avatar.label)
- );
-
- // Assert
- expect(avatar).toBeInTheDocument();
- });
- });
-
- describe('components', () => {
- it('should have a heading', () => {
- // Arrange
- // Nothing to prepare
-
- // Act
- render(ImportProject);
+ render(ImportProject, { data });
const components = screen.getByRole('heading', {
level: 3,
@@ -220,10 +187,62 @@ describe('ImportProject.svelte', () => {
describe('repository', () => {
it('should have a label', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
+
+ const avatar = screen.getByRole('heading', {
+ level: 3,
+ name: enMessages.page.import_project.form.avatar
+ });
+
+ // Assert
+ expect(avatar).toBeInTheDocument();
+ });
+
+ it('should have an upload button', () => {
+ // Arrange
+ const data = {};
+
+ // Act
+ render(ImportProject, { data });
+
+ // Turn into regular expression to account for the icon
+ const avatar = screen.getByLabelText(
+ new RegExp(enMessages.page.import_project.form.fields.avatar.label)
+ );
+
+ // Assert
+ expect(avatar).toBeInTheDocument();
+ });
+ });
+ });
+
+ describe('components', () => {
+ it('should have a heading', () => {
+ // Arrange
+ const data = {};
+
+ // Act
+ render(ImportProject, { data });
+
+ const components = screen.getByRole('heading', {
+ level: 3,
+ name: enMessages.page.import_project.form.components
+ });
+
+ // Assert
+ expect(components).toBeInTheDocument();
+ });
+
+ describe('repository', () => {
+ it('should have a label', () => {
+ // Arrange
+ const data = {};
+
+ // Act
+ render(ImportProject, { data });
// Turn into regular expression to account for the icon
const repository = screen.getByLabelText(
@@ -236,10 +255,10 @@ describe('ImportProject.svelte', () => {
it('should have an URL input', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Turn into regular expression to account for the icon
const repository = screen.getByPlaceholderText(
@@ -252,10 +271,10 @@ describe('ImportProject.svelte', () => {
it('should have a hint', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Turn into regular expression to account for the icon
const repository = screen.getByText(
@@ -270,10 +289,10 @@ describe('ImportProject.svelte', () => {
describe('issues', () => {
it('should have a label', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Turn into regular expression to account for the icon
const issues = screen.getByLabelText(
@@ -288,10 +307,10 @@ describe('ImportProject.svelte', () => {
describe('pull requests', () => {
it('should have a label', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Turn into regular expression to account for the icon
const issues = screen.getByLabelText(enMessages.page.import_project.form.fields.pr.label);
diff --git a/tests/components/pages/Profile.test.ts b/tests/components/pages/Profile.test.ts
new file mode 100644
index 0000000..c87c932
--- /dev/null
+++ b/tests/components/pages/Profile.test.ts
@@ -0,0 +1,181 @@
+import '@testing-library/jest-dom';
+import { render, screen } from '@testing-library/svelte';
+import { init, locale, register } from 'svelte-i18n';
+
+import Profile from '../../../src/lib/components/pages/Profile.svelte';
+import enMessages from '../../../src/lib/i18n/locales/en.json';
+
+describe('Profile.svelte', () => {
+ beforeEach(() => {
+ register('en', () => import('../../../src/lib/i18n/locales/en.json'));
+ init({ fallbackLocale: 'en', initialLocale: 'en' });
+ locale.set('en');
+ });
+
+ it('should mount', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ const { container } = render(Profile, { data });
+
+ // Assert
+ expect(container).toBeTruthy();
+ });
+
+ it('should have a h1', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const h1 = screen.getByRole('heading', { level: 1 });
+
+ // Assert
+ expect(h1).toBeInTheDocument();
+ expect(h1).toHaveTextContent(enMessages.page.profile.heading);
+ });
+
+ it('should have a block button', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const button = screen.getByRole('button', { name: 'block' });
+
+ // Assert
+ expect(button).toBeInTheDocument();
+ });
+
+ it('should have a report button', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const button = screen.getByRole('button', { name: 'report' });
+
+ // Assert
+ expect(button).toBeInTheDocument();
+ });
+
+ // FIXME: Reenable once emoji was replaced with svelte-octicon
+ it.skip('should have a like button', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const button = screen.getByRole('button', { name: enMessages.page.profile.activities.like });
+
+ // Assert
+ expect(button).toBeInTheDocument();
+ });
+
+ describe('projects', () => {
+ it('should have a h2', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const h2 = screen.getByRole('heading', {
+ level: 2,
+ name: enMessages.page.profile.projects.heading
+ });
+
+ // Assert
+ expect(h2).toBeInTheDocument();
+ });
+
+ it('should add a project', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const a = screen.getByRole('link', { name: 'Add a project' });
+
+ // Assert
+ expect(a).toBeInTheDocument();
+ });
+
+ it('should import a project', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const a = screen.getByRole('link', { name: 'import a project' });
+
+ // Assert
+ expect(a).toBeInTheDocument();
+ expect(a).toHaveAttribute('href', '/projects/import/');
+ });
+ });
+
+ describe('history', () => {
+ it('should have a h2', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const h2 = screen.getByRole('heading', {
+ level: 2,
+ name: enMessages.page.profile.history.heading
+ });
+
+ // Assert
+ expect(h2).toBeInTheDocument();
+ });
+
+ it('should have an entry for created account', () => {
+ // Arrange
+ const data = {
+ user: {
+ created_with: 'Anvil',
+ instance: 'domain.example',
+ username: 'jane_doe'
+ }
+ };
+
+ // Act
+ render(Profile, { data });
+ const li = screen.getByRole('listitem');
+
+ // Assert
+ expect(li).toBeInTheDocument();
+ expect(li).toHaveTextContent(
+ new RegExp(enMessages.page.profile.history.activities.setup.summary)
+ );
+ expect(li).toHaveTextContent(
+ new RegExp(
+ enMessages.page.profile.history.activities.setup.description
+ .replace('{username}', data.user.username)
+ .replace('{instance}', data.user.instance)
+ .replace('{created_with}', data.user.created_with)
+ )
+ );
+ });
+ });
+});
diff --git a/tests/components/templates/ImportProject.test.ts b/tests/components/templates/ImportProject.test.ts
index 720e9f9..d525b58 100644
--- a/tests/components/templates/ImportProject.test.ts
+++ b/tests/components/templates/ImportProject.test.ts
@@ -2,7 +2,7 @@ import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/svelte';
import { init, locale, register } from 'svelte-i18n';
-import ImportProject from '../../../src/lib/components/pages/ImportProject.svelte';
+import ImportProject from '../../../src/lib/components/templates/ImportProject.svelte';
import enMessages from '../../../src/lib/i18n/locales/en.json';
describe('ImportProject.svelte', () => {
@@ -14,10 +14,10 @@ describe('ImportProject.svelte', () => {
it('should mount', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- const { container } = render(ImportProject);
+ const { container } = render(ImportProject, { data });
// Assert
expect(container).toBeTruthy();
@@ -25,10 +25,10 @@ describe('ImportProject.svelte', () => {
it('should have a form', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Assert
expect(screen.getByRole('form')).toBeInTheDocument();
@@ -36,10 +36,10 @@ describe('ImportProject.svelte', () => {
it('should have a h2', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
const h2 = screen.getByRole('heading', { level: 2 });
// Assert
@@ -49,10 +49,10 @@ describe('ImportProject.svelte', () => {
it('should have an intro text', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Assert
expect(screen.getByText(enMessages.page.import_project.intro)).toBeInTheDocument();
@@ -61,10 +61,10 @@ describe('ImportProject.svelte', () => {
describe('name', () => {
it('should have a label', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Turn into regular expression to account for the asterisk
const name = screen.getByLabelText(
@@ -77,10 +77,10 @@ describe('ImportProject.svelte', () => {
it('should have a text input', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
const name = screen.getByPlaceholderText(
enMessages.page.import_project.form.fields.name.placeholder
@@ -94,10 +94,10 @@ describe('ImportProject.svelte', () => {
describe('when empty', () => {
it('should display an error', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Assert
expect(
@@ -110,10 +110,10 @@ describe('ImportProject.svelte', () => {
describe.skip('when filled', () => {
it('should hide the error', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Assert
expect(
@@ -123,10 +123,11 @@ describe('ImportProject.svelte', () => {
it('should show a live updating hint', () => {
// Arrange
+ const data = {};
const value = 'Vervis';
// Act
- render(ImportProject, { value });
+ render(ImportProject, { data, value });
// Assert
expect(screen.getByText(`domain.example/projects/${value}`)).toBeInTheDocument();
@@ -137,10 +138,10 @@ describe('ImportProject.svelte', () => {
describe('description', () => {
it('should have a label', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
const description = screen.getByLabelText(
enMessages.page.import_project.form.fields.description.label
@@ -152,10 +153,10 @@ describe('ImportProject.svelte', () => {
it('should have a textarea', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
const description = screen.getByPlaceholderText(
enMessages.page.import_project.form.fields.description.placeholder
@@ -169,44 +170,10 @@ describe('ImportProject.svelte', () => {
describe('avatar', () => {
it('should have a heading', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
-
- const avatar = screen.getByRole('heading', {
- level: 3,
- name: enMessages.page.import_project.form.avatar
- });
-
- // Assert
- expect(avatar).toBeInTheDocument();
- });
-
- it('should have an upload button', () => {
- // Arrange
- // Nothing to prepare
-
- // Act
- render(ImportProject);
-
- // Turn into regular expression to account for the icon
- const avatar = screen.getByLabelText(
- new RegExp(enMessages.page.import_project.form.fields.avatar.label)
- );
-
- // Assert
- expect(avatar).toBeInTheDocument();
- });
- });
-
- describe('components', () => {
- it('should have a heading', () => {
- // Arrange
- // Nothing to prepare
-
- // Act
- render(ImportProject);
+ render(ImportProject, { data });
const components = screen.getByRole('heading', {
level: 3,
@@ -220,10 +187,62 @@ describe('ImportProject.svelte', () => {
describe('repository', () => {
it('should have a label', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
+
+ const avatar = screen.getByRole('heading', {
+ level: 3,
+ name: enMessages.page.import_project.form.avatar
+ });
+
+ // Assert
+ expect(avatar).toBeInTheDocument();
+ });
+
+ it('should have an upload button', () => {
+ // Arrange
+ const data = {};
+
+ // Act
+ render(ImportProject, { data });
+
+ // Turn into regular expression to account for the icon
+ const avatar = screen.getByLabelText(
+ new RegExp(enMessages.page.import_project.form.fields.avatar.label)
+ );
+
+ // Assert
+ expect(avatar).toBeInTheDocument();
+ });
+ });
+ });
+
+ describe('components', () => {
+ it('should have a heading', () => {
+ // Arrange
+ const data = {};
+
+ // Act
+ render(ImportProject, { data });
+
+ const components = screen.getByRole('heading', {
+ level: 3,
+ name: enMessages.page.import_project.form.components
+ });
+
+ // Assert
+ expect(components).toBeInTheDocument();
+ });
+
+ describe('repository', () => {
+ it('should have a label', () => {
+ // Arrange
+ const data = {};
+
+ // Act
+ render(ImportProject, { data });
// Turn into regular expression to account for the icon
const repository = screen.getByLabelText(
@@ -236,10 +255,10 @@ describe('ImportProject.svelte', () => {
it('should have an URL input', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Turn into regular expression to account for the icon
const repository = screen.getByPlaceholderText(
@@ -252,10 +271,10 @@ describe('ImportProject.svelte', () => {
it('should have a hint', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Turn into regular expression to account for the icon
const repository = screen.getByText(
@@ -270,10 +289,10 @@ describe('ImportProject.svelte', () => {
describe('issues', () => {
it('should have a label', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Turn into regular expression to account for the icon
const issues = screen.getByLabelText(
@@ -288,10 +307,10 @@ describe('ImportProject.svelte', () => {
describe('pull requests', () => {
it('should have a label', () => {
// Arrange
- // Nothing to prepare
+ const data = {};
// Act
- render(ImportProject);
+ render(ImportProject, { data });
// Turn into regular expression to account for the icon
const issues = screen.getByLabelText(enMessages.page.import_project.form.fields.pr.label);
diff --git a/tests/components/templates/Profile.test.ts b/tests/components/templates/Profile.test.ts
new file mode 100644
index 0000000..4aa32c7
--- /dev/null
+++ b/tests/components/templates/Profile.test.ts
@@ -0,0 +1,181 @@
+import '@testing-library/jest-dom';
+import { render, screen } from '@testing-library/svelte';
+import { init, locale, register } from 'svelte-i18n';
+
+import Profile from '../../../src/lib/components/templates/Profile.svelte';
+import enMessages from '../../../src/lib/i18n/locales/en.json';
+
+describe('Profile.svelte', () => {
+ beforeEach(() => {
+ register('en', () => import('../../../src/lib/i18n/locales/en.json'));
+ init({ fallbackLocale: 'en', initialLocale: 'en' });
+ locale.set('en');
+ });
+
+ it('should mount', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ const { container } = render(Profile, { data });
+
+ // Assert
+ expect(container).toBeTruthy();
+ });
+
+ it('should have a h1', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const h1 = screen.getByRole('heading', { level: 1 });
+
+ // Assert
+ expect(h1).toBeInTheDocument();
+ expect(h1).toHaveTextContent(enMessages.page.profile.heading);
+ });
+
+ it('should have a block button', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const button = screen.getByRole('button', { name: 'block' });
+
+ // Assert
+ expect(button).toBeInTheDocument();
+ });
+
+ it('should have a report button', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const button = screen.getByRole('button', { name: 'report' });
+
+ // Assert
+ expect(button).toBeInTheDocument();
+ });
+
+ // FIXME: Reenable once emoji was replaced with svelte-octicon
+ it.skip('should have a like button', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const button = screen.getByRole('button', { name: enMessages.page.profile.activities.like });
+
+ // Assert
+ expect(button).toBeInTheDocument();
+ });
+
+ describe('projects', () => {
+ it('should have a h2', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const h2 = screen.getByRole('heading', {
+ level: 2,
+ name: enMessages.page.profile.projects.heading
+ });
+
+ // Assert
+ expect(h2).toBeInTheDocument();
+ });
+
+ it('should add a project', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const a = screen.getByRole('link', { name: 'Add a project' });
+
+ // Assert
+ expect(a).toBeInTheDocument();
+ });
+
+ it('should import a project', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const a = screen.getByRole('link', { name: 'import a project' });
+
+ // Assert
+ expect(a).toBeInTheDocument();
+ expect(a).toHaveAttribute('href', '/projects/import/');
+ });
+ });
+
+ describe('history', () => {
+ it('should have a h2', () => {
+ // Arrange
+ const data = {
+ user: {}
+ };
+
+ // Act
+ render(Profile, { data });
+ const h2 = screen.getByRole('heading', {
+ level: 2,
+ name: enMessages.page.profile.history.heading
+ });
+
+ // Assert
+ expect(h2).toBeInTheDocument();
+ });
+
+ it('should have an entry for created account', () => {
+ // Arrange
+ const data = {
+ user: {
+ created_with: 'Anvil',
+ instance: 'domain.example',
+ username: 'jane_doe'
+ }
+ };
+
+ // Act
+ render(Profile, { data });
+ const li = screen.getByRole('listitem');
+
+ // Assert
+ expect(li).toBeInTheDocument();
+ expect(li).toHaveTextContent(
+ new RegExp(enMessages.page.profile.history.activities.setup.summary)
+ );
+ expect(li).toHaveTextContent(
+ new RegExp(
+ enMessages.page.profile.history.activities.setup.description
+ .replace('{username}', data.user.username)
+ .replace('{instance}', data.user.instance)
+ .replace('{created_with}', data.user.created_with)
+ )
+ );
+ });
+ });
+});