Skip to content

Gr5 bonus2 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: group-5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
"files.autoSaveDelay": 500,
"editor.minimap.enabled": false,
"workbench.colorTheme": "Default Dark+",
"editor.tabSize": 2
}
File renamed without changes.
22 changes: 22 additions & 0 deletions bonus2/src/solution.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
exports.solve = function (param) {
if (param === 'a') {
return false;
}
return true;
}

const solveConsonants = function(string) {
return string.split(/[ae1yio]+/i).sort((a, b) => b.length - a.length)[0];
}

const isConsonant = (letter) => {
let consonants = [
'b', 'c', 'd', 'f', 'g', 'h',
'j', 'k', 'l', 'm', 'n', 'p',
'r', 's', 't', 'w', 'z'];

return consonants.includes(letter);
}

exports.isConsonant = isConsonant;
exports.solveConsonants = solveConsonants
58 changes: 58 additions & 0 deletions bonus2/src/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const { solve, solveConsonants, isConsonant } = require('./solution');

describe('solve', () => {
it('should be consonant', () => {
expect( solve('b') ).toBe(true);
});

it('should not be vowel', () => {
expect( solve('a') ).toBe(false);
});

it('should return substring', () => {
expect(isConsonant('b')).toBe(true);
});

it('should return substring', () => {
expect(isConsonant('a')).toBe(false);
});

it('should return true if parameter if consonant', () => {
expect(isConsonant('d')).toBe(true);
});
});

describe('solveConsonants', () => {
it('should return only consonants', () => {
expect(solveConsonants('abc')).toBe('bc');
})

it('should return substring', () => {
expect(solveConsonants('bcdabcdbcd')).toBe('bcdbcd');
});

it('should return substring', () => {
expect(solveConsonants('bcdabcdbcda')).toBe('bcdbcd');
});

it('should return substring', () => {
expect(solveConsonants('bcd1bcdbcda')).toBe('bcdbcd');
});

it('should return substring', () => {
expect(solveConsonants('bcdghk')).toBe('bcdghk');
});
})



// check ===
// expect(1).toBe(1)

// check deep equality
// expect([1, 2]).toEqual([1, 2])

// spółgłoski:
// b, c, d, f, g, h, j, k, l, m, n, p, r, s, t, w, z
// samogłoski:
// a, e, i, o, u, y
File renamed without changes.
38 changes: 0 additions & 38 deletions minesweeper/src/solution.js

This file was deleted.

65 changes: 0 additions & 65 deletions minesweeper/src/test.js

This file was deleted.