Skip to content

Commit

Permalink
new contribution
Browse files Browse the repository at this point in the history
  • Loading branch information
Kousthubh02 committed Apr 6, 2024
1 parent e2e23d4 commit 3d4a107
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
8 changes: 8 additions & 0 deletions _haikus/2024_kosu
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
layout : haiku
title: Open SOurce
author : Kousthubh Yadavalli
---

Heyy there guys this is kousthubh , i have now made my first open source contribution
This is the beginning of a new journey
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"remark-frontmatter": "^1.3.2",
"strip-markdown": "^3.1.1",
"syllable": "^4.0.0",
"tap": "^14.6.9",
"tap": "^14.11.0",
"to-vfile": "^6.0.0",
"yaml": "^1.7.0"
}
Expand Down
22 changes: 11 additions & 11 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ const fs = require('fs')
const dir = './_haikus/'
const blockList = ['haikus.md']

const files = fs.readdirSync(dir)
const files = fs.readdirSync(dir);

files.forEach(async (file) => {
if (!blockList.includes(file)) {
const [text, meta] = await processMarkdown(dir + file)
const lines = text.split('\n').filter((line) => line !== '')

if (meta.test !== false) {
validateHaiku(file, lines, meta)
validateHaiku(file, lines, meta);
}
}
})
Expand All @@ -33,9 +33,9 @@ function processMarkdown(filename) {
.use(strip)
.process(vfile.readSync(filename), (err, file) => {
if (err) {
reject(err)
reject(err);
} else {
resolve([file.toString(), file.data])
resolve([file.toString(), file.data]);
}
})
})
Expand All @@ -44,7 +44,7 @@ function processMarkdown(filename) {
function validateHaiku(filename, lines, meta) {
describe(filename, () => {
it("should have a '.md' file extension", () => {
assert.ok(/\.md$/.test(filename), "extension does not match '.md'")
assert.ok(/\.md$/.test(filename), "extension does not match '.md'");
})

describe('file metadata', () => {
Expand All @@ -57,29 +57,29 @@ function validateHaiku(filename, lines, meta) {
})

it('should have non-blank title', () => {
assert.equal(typeof meta.title, 'string', 'title metadata is missing')
assert.equal(typeof meta.title, 'string', 'title metadata is missing');
})

it('should have non-blank author', () => {
assert.equal(typeof meta.author, 'string', 'author metadata is missing')
assert.equal(typeof meta.author, 'string', 'author metadata is missing');
})
})

describe('haiku structure', () => {
it('should have three lines', () => {
assert.equal(lines.length, 3)
assert.equal(lines.length, 3);
})

it('should have five syllables on the first line', () => {
assert.equal(syllable(lines[0]), 5)
assert.equal(syllable(lines[0]), 5);
})

it('should have seven syllables on the second line', () => {
assert.equal(syllable(lines[1]), 7)
assert.equal(syllable(lines[1]), 7);
})

it('should have five syllables on the third line', () => {
assert.equal(syllable(lines[2]), 5)
assert.equal(syllable(lines[2]), 5);
})
})
})
Expand Down

0 comments on commit 3d4a107

Please sign in to comment.