From d86de5dc280983fa68ab536351e7adddf988064c Mon Sep 17 00:00:00 2001
From: Nawfel Senoussi <nawfelsen@mbp-de-nawfel.home>
Date: Thu, 28 Mar 2024 23:03:29 +0100
Subject: [PATCH] split feature into more specific folder

---
 .../{ => association}/createAssociation.ts    |  2 +-
 .../{ => association}/joinAssociation.ts      |  2 +-
 .../showAssociationDetails.ts                 |  2 +-
 .../{ => association}/showAssociations.ts     |  2 +-
 src/features/{ => balance}/showBalance.ts     |  2 +-
 src/features/{ => proposal}/createProposal.ts |  2 +-
 src/features/{ => token}/burnToken.ts         |  2 +-
 src/features/{ => token}/createToken.ts       |  2 +-
 src/handlers/roleHandlers.ts                  | 16 +++++-----
 src/utils/getRole.ts                          |  2 +-
 test/handlers/roleHandlers.spec.ts            | 32 +++++++++----------
 11 files changed, 33 insertions(+), 33 deletions(-)
 rename src/features/{ => association}/createAssociation.ts (81%)
 rename src/features/{ => association}/joinAssociation.ts (93%)
 rename src/features/{ => association}/showAssociationDetails.ts (93%)
 rename src/features/{ => association}/showAssociations.ts (82%)
 rename src/features/{ => balance}/showBalance.ts (82%)
 rename src/features/{ => proposal}/createProposal.ts (82%)
 rename src/features/{ => token}/burnToken.ts (83%)
 rename src/features/{ => token}/createToken.ts (83%)

diff --git a/src/features/createAssociation.ts b/src/features/association/createAssociation.ts
similarity index 81%
rename from src/features/createAssociation.ts
rename to src/features/association/createAssociation.ts
index d97720b..6891f77 100644
--- a/src/features/createAssociation.ts
+++ b/src/features/association/createAssociation.ts
@@ -1,6 +1,6 @@
 import { type TezosToolkit } from '@taquito/taquito'
 import chalk from 'chalk'
-import { handleCreateAssociation } from '../handlers/association/associationHandlers.js'
+import { handleCreateAssociation } from '../../handlers/association/associationHandlers.js'
 
 async function createAssociation (tezos: TezosToolkit): Promise<void> {
   await handleCreateAssociation(tezos).then(() => {
diff --git a/src/features/joinAssociation.ts b/src/features/association/joinAssociation.ts
similarity index 93%
rename from src/features/joinAssociation.ts
rename to src/features/association/joinAssociation.ts
index d1637f9..7deff69 100644
--- a/src/features/joinAssociation.ts
+++ b/src/features/association/joinAssociation.ts
@@ -1,6 +1,6 @@
 import { type TezosToolkit } from '@taquito/taquito'
 import chalk from 'chalk'
-import { handleGetAssociations, handleJoinAssociation } from '../handlers/association/associationHandlers.js'
+import { handleGetAssociations, handleJoinAssociation } from '../../handlers/association/associationHandlers.js'
 
 async function joinAssociation (tezos: TezosToolkit): Promise<void> {
   await handleGetAssociations(tezos).then(async (response) => {
diff --git a/src/features/showAssociationDetails.ts b/src/features/association/showAssociationDetails.ts
similarity index 93%
rename from src/features/showAssociationDetails.ts
rename to src/features/association/showAssociationDetails.ts
index bc7d1f4..cabe9ee 100644
--- a/src/features/showAssociationDetails.ts
+++ b/src/features/association/showAssociationDetails.ts
@@ -1,6 +1,6 @@
 import { type TezosToolkit } from '@taquito/taquito'
 import chalk from 'chalk'
-import { handleGetAssociationDetails, handleGetAssociations } from '../handlers/association/associationHandlers.js'
+import { handleGetAssociationDetails, handleGetAssociations } from '../../handlers/association/associationHandlers.js'
 
 async function showAssociationDetails (tezos: TezosToolkit): Promise<void> {
   await handleGetAssociations(tezos).then(async (response) => {
diff --git a/src/features/showAssociations.ts b/src/features/association/showAssociations.ts
similarity index 82%
rename from src/features/showAssociations.ts
rename to src/features/association/showAssociations.ts
index 9a0409d..04f4985 100644
--- a/src/features/showAssociations.ts
+++ b/src/features/association/showAssociations.ts
@@ -1,6 +1,6 @@
 import { type TezosToolkit } from '@taquito/taquito'
 import chalk from 'chalk'
-import { handleGetAssociations } from '../handlers/association/associationHandlers.js'
+import { handleGetAssociations } from '../../handlers/association/associationHandlers.js'
 
 async function showAssociations (tezos: TezosToolkit): Promise<void> {
   await handleGetAssociations(tezos).then((response) => {
diff --git a/src/features/showBalance.ts b/src/features/balance/showBalance.ts
similarity index 82%
rename from src/features/showBalance.ts
rename to src/features/balance/showBalance.ts
index d45be36..ebd9de1 100644
--- a/src/features/showBalance.ts
+++ b/src/features/balance/showBalance.ts
@@ -1,6 +1,6 @@
 import { type TezosToolkit } from '@taquito/taquito'
 import chalk from 'chalk'
-import { handleGetBalance } from '../handlers/balance/balanceHandlers.js'
+import { handleGetBalance } from '../../handlers/balance/balanceHandlers.js'
 
 async function showBalance (tezos: TezosToolkit): Promise<void> {
   await handleGetBalance(tezos).then((response) => {
diff --git a/src/features/createProposal.ts b/src/features/proposal/createProposal.ts
similarity index 82%
rename from src/features/createProposal.ts
rename to src/features/proposal/createProposal.ts
index 99e4e5c..9a8dc2c 100644
--- a/src/features/createProposal.ts
+++ b/src/features/proposal/createProposal.ts
@@ -1,6 +1,6 @@
 import { type TezosToolkit } from '@taquito/taquito'
 import chalk from 'chalk'
-import { handleCreateProposal } from '../handlers/proposal/proposalHandlers.js'
+import { handleCreateProposal } from '../../handlers/proposal/proposalHandlers.js'
 
 async function createProposal (tezos: TezosToolkit): Promise<void> {
   await handleCreateProposal(tezos).then(() => {
diff --git a/src/features/burnToken.ts b/src/features/token/burnToken.ts
similarity index 83%
rename from src/features/burnToken.ts
rename to src/features/token/burnToken.ts
index 5ebd2b4..a2bd04d 100644
--- a/src/features/burnToken.ts
+++ b/src/features/token/burnToken.ts
@@ -1,6 +1,6 @@
 import { type TezosToolkit } from '@taquito/taquito'
 import chalk from 'chalk'
-import { handleBurnToken } from '../handlers/token/tokenHandlers.js'
+import { handleBurnToken } from '../../handlers/token/tokenHandlers.js'
 
 async function burnToken (tezos: TezosToolkit): Promise<void> {
   await handleBurnToken(tezos).then(() => {
diff --git a/src/features/createToken.ts b/src/features/token/createToken.ts
similarity index 83%
rename from src/features/createToken.ts
rename to src/features/token/createToken.ts
index 0f3a033..4a780e4 100644
--- a/src/features/createToken.ts
+++ b/src/features/token/createToken.ts
@@ -1,6 +1,6 @@
 import { type TezosToolkit } from '@taquito/taquito'
 import chalk from 'chalk'
-import { handleCreateToken } from '../handlers/token/tokenHandlers.js'
+import { handleCreateToken } from '../../handlers/token/tokenHandlers.js'
 
 async function createToken (tezos: TezosToolkit): Promise<void> {
   await handleCreateToken(tezos).then(() => {
diff --git a/src/handlers/roleHandlers.ts b/src/handlers/roleHandlers.ts
index 4aa5fa0..2a37892 100644
--- a/src/handlers/roleHandlers.ts
+++ b/src/handlers/roleHandlers.ts
@@ -1,13 +1,13 @@
 import { type TezosToolkit } from '@taquito/taquito'
 import chalk from 'chalk'
-import { showAssociations } from '../features/showAssociations.js'
-import { showAssociationDetails } from '../features/showAssociationDetails.js'
-import { showBalance } from '../features/showBalance.js'
-import { joinAssociation } from '../features/joinAssociation.js'
-import { createAssociation } from '../features/createAssociation.js'
-import { burnToken } from '../features/burnToken.js'
-import { createToken } from '../features/createToken.js'
-import { createProposal } from '../features/createProposal.js'
+import { showAssociations } from '../features/association/showAssociations.js'
+import { showAssociationDetails } from '../features/association/showAssociationDetails.js'
+import { showBalance } from '../features/balance/showBalance.js'
+import { joinAssociation } from '../features/association/joinAssociation.js'
+import { createAssociation } from '../features/association/createAssociation.js'
+import { burnToken } from '../features/token/burnToken.js'
+import { createToken } from '../features/token/createToken.js'
+import { createProposal } from '../features/proposal/createProposal.js'
 
 /**
  * Handles fa token administrator actions based on the specified choice.
diff --git a/src/utils/getRole.ts b/src/utils/getRole.ts
index 8b0c006..e21034d 100644
--- a/src/utils/getRole.ts
+++ b/src/utils/getRole.ts
@@ -9,5 +9,5 @@ export function getRole (tezos: TezosToolkit): Role {
   // ELSE -> CONNECTED
 
   // TEMPORARY
-  return 'ADHERENT'
+  return 'ADMIN_FA_TOKEN'
 }
diff --git a/test/handlers/roleHandlers.spec.ts b/test/handlers/roleHandlers.spec.ts
index 9a63f9d..985ec19 100644
--- a/test/handlers/roleHandlers.spec.ts
+++ b/test/handlers/roleHandlers.spec.ts
@@ -2,43 +2,43 @@ import { type TezosToolkit } from '@taquito/taquito'
 import { handleAdminFATokenChoice, handleAdminAssociationChoice, handleAdherentChoice, handleConnectedChoice } from '../../src/handlers/roleHandlers'
 import { vi, describe, it, expect, beforeEach } from 'vitest'
 import chalk from 'chalk'
-import { createAssociation } from '../../src/features/createAssociation'
-import { burnToken } from '../../src/features/burnToken'
-import { createToken } from '../../src/features/createToken'
-import { showBalance } from '../../src/features/showBalance'
-import { createProposal } from '../../src/features/createProposal'
-import { joinAssociation } from '../../src/features/joinAssociation'
-import { showAssociations } from '../../src/features/showAssociations'
-
-vi.mock('../../src/features/createAssociation', () => ({
+import { createAssociation } from '../../src/features/association/createAssociation'
+import { burnToken } from '../../src/features/token/burnToken'
+import { createToken } from '../../src/features/token/createToken'
+import { showBalance } from '../../src/features/balance/showBalance'
+import { createProposal } from '../../src/features/proposal/createProposal'
+import { joinAssociation } from '../../src/features/association/joinAssociation'
+import { showAssociations } from '../../src/features/association/showAssociations'
+
+vi.mock('../../src/features/association/createAssociation', () => ({
   createAssociation: vi.fn()
 }))
 
-vi.mock('../../src/features/burnToken', () => ({
+vi.mock('../../src/features/token/burnToken', () => ({
   burnToken: vi.fn()
 }))
 
-vi.mock('../../src/features/createProposal', () => ({
+vi.mock('../../src/features/proposal/createProposal', () => ({
   createProposal: vi.fn()
 }))
 
-vi.mock('../../src/features/createToken', () => ({
+vi.mock('../../src/features/token/createToken', () => ({
   createToken: vi.fn()
 }))
 
-vi.mock('../../src/features/joinAssociation', () => ({
+vi.mock('../../src/features/association/joinAssociation', () => ({
   joinAssociation: vi.fn()
 }))
 
-vi.mock('../../src/features/showAssociationDetails', () => ({
+vi.mock('../../src/features/association/showAssociationDetails', () => ({
   showAssociationDetails: vi.fn()
 }))
 
-vi.mock('../../src/features/showAssociations', () => ({
+vi.mock('../../src/features/association/showAssociations', () => ({
   showAssociations: vi.fn()
 }))
 
-vi.mock('../../src/features/showBalance', () => ({
+vi.mock('../../src/features/balance/showBalance', () => ({
   showBalance: vi.fn()
 }))
 
-- 
GitLab