-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4014157
commit 8f60acc
Showing
18 changed files
with
958 additions
and
714 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package input | ||
|
||
import ( | ||
"anemon/internal/adapters/output" | ||
"anemon/internal/core" | ||
) | ||
|
||
//Use the implementation for markdown and latex to generate latex CV from a tree dir of mardown document | ||
func GenerateCVFromMarkDownToLatex(root string)error{ | ||
var source core.Source = &MarkdownSource{} | ||
var templateReader core.TemplateReader = &output.LatexReader{} | ||
var templateProccesor core.TemplateProcessor = &output.LatexProccesor{} | ||
service := &core.CVService{} | ||
return service.GenerateTemplates(root,source,templateReader,templateProccesor) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
package input | ||
|
||
import ( | ||
core "anemon/internal/core" | ||
"os" | ||
"path/filepath" | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
var( | ||
work_input = ` | ||
# Back-End Intern | ||
## February 2024 -- August 2024 | ||
### TechCorp | ||
#### Internship | ||
- Assisted in developing and optimizing a key business process for expanding into new markets, collaborating with various teams to ensure compliance and smooth integration. | ||
- Participated in the migration of core backend logic from a monolithic application to a microservice architecture, improving system performance and scalability. | ||
- Enhanced system monitoring and reliability by implementing tracing mechanisms and performance objectives. | ||
# Back-End Intern | ||
## February 2024 -- August 2024 | ||
### TechCorp | ||
#### Internship | ||
- Assisted in developing and optimizing a key business process for expanding into new markets, collaborating with various teams to ensure compliance and smooth integration. | ||
- Participated in the migration of core backend logic from a monolithic application to a microservice architecture, improving system performance and scalability. | ||
- Enhanced system monitoring and reliability by implementing tracing mechanisms and performance objectives.` | ||
|
||
skill_input =` | ||
**Langage** | ||
- Langage A, Langage B, Langage C, Langage D, Langage E, Langage F, Langage G/H | ||
**Langage** | ||
- Langage A, Langage B, Langage C, Langage D, Langage E, Langage F, Langage G/H` | ||
invalid_skill_input =` | ||
- Langage A, Langage B, Langage C, Langage D, Langage E, Langage F, Langage G/H | ||
**Langag | ||
- Langage A, Langage B, Langage C, Langage D, Langage E, Langage F, Langage G/H` | ||
|
||
|
||
|
||
skill_paragraphe = core.Paragraphe{H1: "Langage", H2: "Langage A, Langage B, Langage C, Langage D, Langage E, Langage F, Langage G/H"} | ||
|
||
work_paragraphe = core.Paragraphe{H1: "Back-End Intern", H2: "February 2024 -- August 2024", | ||
H3: "TechCorp", H4: "Internship",Items: []string{ | ||
"Assisted in developing and optimizing a key business process for expanding into new markets, collaborating with various teams to ensure compliance and smooth integration.", | ||
"Participated in the migration of core backend logic from a monolithic application to a microservice architecture, improving system performance and scalability.", | ||
"Enhanced system monitoring and reliability by implementing tracing mechanisms and performance objectives."}} | ||
|
||
invalid_input = "ajsdlhsaeld##dafdbhkbhkjsd##" | ||
work_expected_result = []core.Paragraphe{work_paragraphe,work_paragraphe} | ||
skill_expected_result = []core.Paragraphe{skill_paragraphe,skill_paragraphe} | ||
|
||
paths = []struct { | ||
relativePath string | ||
content string | ||
}{ | ||
{"cv/eng/education.md", work_input}, | ||
{"cv/eng/project.md", work_input}, | ||
{"cv/eng/work.md", work_input}, | ||
{"cv/eng/skill.md", skill_input}, | ||
{"cv/fr/education.md", work_input}, | ||
{"cv/fr/work.md", work_input}, | ||
{"cv/fr/skill.md", skill_input}, | ||
} | ||
|
||
) | ||
|
||
func TestParagraphe(t *testing.T) { | ||
|
||
t.Run("Work Paragraphes should return a slice of valid Paragraphe", func (t *testing.T) { | ||
got := getParagrapheFrom(work_input) | ||
want := work_expected_result | ||
if !reflect.DeepEqual(got[0], want[0]){ | ||
t.Fatalf("the first Paragraphe should be :\n%s\n got :%s",want,got) | ||
} | ||
|
||
if !reflect.DeepEqual(got[1], want[1]){ | ||
t.Fatalf("the first Paragraphe should be :\n%s\n got :%s",want,got) | ||
} | ||
}) | ||
|
||
t.Run("Invalid input should return nothing", func (t *testing.T) { | ||
result := getParagrapheFrom(invalid_input) | ||
if result != nil{ | ||
t.Fatalf("Invalid input should return nil got %v",result) | ||
} | ||
}) | ||
|
||
t.Run("Skill Paragraphe should be return from valid input", func (t *testing.T) { | ||
got := getParagrapheFrom(skill_input) | ||
want := skill_expected_result | ||
if !reflect.DeepEqual(got,want){ | ||
t.Fatalf("the first Paragraphe should be :\n%s\n got :%s",want,got) | ||
} | ||
}) | ||
|
||
t.Run("Invalid skill Paragraphe should return nil", func (t *testing.T) { | ||
got := getParagrapheFrom(invalid_skill_input) | ||
if got != nil{ | ||
t.Fatalf("Invalid input should return nil got %v",got) | ||
} | ||
}) | ||
} | ||
|
||
func TestSections(t *testing.T) { | ||
rootDir := t.TempDir() | ||
for _, p := range paths { | ||
fullPath := filepath.Join(rootDir, p.relativePath) | ||
if err := os.MkdirAll(filepath.Dir(fullPath), os.ModePerm); err != nil { | ||
t.Fatalf("Failed to create directories: %v", err) | ||
} | ||
if err := os.WriteFile(fullPath, []byte(p.content), os.ModePerm); err != nil { | ||
t.Fatalf("Failed to write file: %v", err) | ||
} | ||
} | ||
|
||
t.Run("Should return a valid list of cv", func (t *testing.T) { | ||
source := MarkdownSource{} | ||
got,err := source.GetCVsFrom(rootDir) | ||
if err!=nil{ | ||
t.Fatalf("Failed to getCV got %s",err) | ||
} | ||
|
||
lang_got := got[len(got)-1].Lang | ||
l_want := "fr" | ||
if lang_got != l_want{ | ||
t.Fatalf("Should have %s got %s",l_want,lang_got) | ||
} | ||
|
||
sec_got := len(got[len(got)-1].Sections) | ||
s_want := 3 | ||
if sec_got != s_want{ | ||
t.Fatalf("Should have %d got %d",s_want,sec_got) | ||
} | ||
|
||
t_sec_got := got[len(got)-1].Sections[len(got[len(got)-1].Sections)-1].Title | ||
t_s_want := "work" | ||
if t_sec_got != t_s_want{ | ||
t.Fatalf("Should have %s got %s",t_s_want,t_sec_got) | ||
} | ||
|
||
p_t_sec_got := got[len(got)-1].Sections[len(got[len(got)-1].Sections)-1].Paragraphes | ||
p_t_s_want := work_expected_result | ||
|
||
if len(p_t_sec_got) != len(p_t_s_want){ t.Fatalf("Should have len %d got %d",len(p_t_s_want),len(p_t_sec_got)) } | ||
|
||
if p_t_sec_got[len(p_t_sec_got)-1].H1 != p_t_s_want[len(p_t_s_want)-1].H1{ | ||
t.Fatalf("Should have title %s got %s",p_t_s_want[len(p_t_s_want)-1].H1,p_t_sec_got[len(p_t_sec_got)-1].H1) | ||
} | ||
|
||
}) | ||
} |
Oops, something went wrong.