-
Notifications
You must be signed in to change notification settings - Fork 33
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
Бёрдов Дмитрий #36
base: master
Are you sure you want to change the base?
Бёрдов Дмитрий #36
Changes from all commits
dfbcfd2
32b7cdf
d4002e6
d38e02f
5dc8d6f
59924fa
26235b2
fb4b836
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,131 @@ describe('getPokerHand', () => { | |
const actual = getPokerHand([1, 1, 1, 1, 1]); | ||
|
||
assert.equal(actual, 'Покер'); | ||
}); | ||
}) | ||
}); | ||
|
||
|
||
describe('getPokerHand', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Нужно объявить один
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Это замечание всё ещё актуально |
||
it('should return `Каре` for [4, 1, 1, 1, 1]', () => { | ||
const actual = getPokerHand([4, 1, 1, 1, 1]); | ||
|
||
assert.equal(actual, 'Каре'); | ||
}) | ||
}); | ||
|
||
describe('getPokerHand', () => { | ||
it('should return `Фулл хаус` for [1, 1, 1, 2, 2]', () => { | ||
const actual = getPokerHand([1, 1, 1, 2, 2]); | ||
|
||
assert.equal(actual, 'Фулл хаус'); | ||
}) | ||
}); | ||
|
||
describe('getPokerHand', () => { | ||
it('should return `Тройка` for [1, 1, 1, 5, 6]', () => { | ||
const actual = getPokerHand([1, 1, 1, 5, 6]); | ||
|
||
// Напишите тесты на ваш замечательный код здесь | ||
assert.equal(actual, 'Тройка'); | ||
}) | ||
}); | ||
|
||
describe('getPokerHand', () => { | ||
it('should return `Две пары` for [1, 1, 2, 3, 3]', () => { | ||
const actual = getPokerHand([1, 1, 2, 3, 3]); | ||
|
||
assert.equal(actual, 'Две пары'); | ||
}) | ||
}); | ||
|
||
describe('getPokerHand', () => { | ||
it('should return `Пара` for [1, 1, 4, 5, 6]', () => { | ||
const actual = getPokerHand([1, 1, 4, 5, 6]); | ||
|
||
assert.equal(actual, 'Пара'); | ||
}) | ||
}); | ||
|
||
describe('getPokerHand', () => { | ||
it('should return `Наивысшее очко` for [5, 4, 3, 2, 1]', () => { | ||
const actual = getPokerHand([5, 4, 3, 2, 1]); | ||
|
||
assert.equal(actual, 'Наивысшее очко'); | ||
}) | ||
}); | ||
|
||
describe('getPokerHand', () => { | ||
it('should throw error `Не массив` for 5', () => { | ||
try{ | ||
const actual = getPokerHand(5); | ||
throw new Error('`getPokerHand` should throw error'); | ||
} catch (error) { | ||
assert.equal(error.message, 'Не массив'); | ||
} | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Попробуй воспользоваться |
||
}); | ||
|
||
describe('getPokerHand', () => { | ||
it('should throw error `Элементов меньше 5-ти` for [1, 1, 4, 5]', () => { | ||
try { | ||
const actual = getPokerHand([1, 1, 4, 5]); | ||
throw new Error('`getPokerHand` should throw error'); | ||
} catch (error) { | ||
assert.equal(error.message, 'Элементов меньше 5-ти'); | ||
} | ||
}) | ||
}); | ||
|
||
describe('getPokerHand', () => { | ||
it('should throw error `Элементов больше 5-ти` for [5, 2, 3, 5, 1, 1, 5]', () => { | ||
try{ | ||
const actual = getPokerHand([5, 2, 3, 5, 1, 1, 5]); | ||
throw new Error('`getPokerHand` should throw error'); | ||
} catch (error) { | ||
assert.equal(error.message, 'Элементов больше 5-ти'); | ||
} | ||
}) | ||
}); | ||
|
||
describe('getPokerHand', () => { | ||
it('should throw error `Не массив` for ', () => { | ||
try{ | ||
const actual = getPokerHand(); | ||
throw new Error('`getPokerHand` should throw error'); | ||
} catch (error) { | ||
assert.equal(error.message, 'Не массив'); | ||
} | ||
}) | ||
}); | ||
|
||
describe('getPokerHand', () => { | ||
it('should throw error `Массив содержит элемент, не являющийся числом` for ["a", "b", "c", "d", "e"]', () => { | ||
try{ | ||
const actual = getPokerHand(["a", "b", "c", "d", "e"]); | ||
throw new Error('`getPokerHand` should throw error'); | ||
} catch (error) { | ||
assert.equal(error.message, 'Массив содержит элемент, не являющийся числом'); | ||
} | ||
}) | ||
}); | ||
|
||
describe('getPokerHand', () => { | ||
it('should throw error `Массив содержит элемент, больший 6` for [1, 2, 3, 4, 7]', () => { | ||
try{ | ||
const actual = getPokerHand([1, 2, 3, 4, 7]); | ||
throw new Error('`getPokerHand` should throw error'); | ||
} catch (error) { | ||
assert.equal(error.message, 'Массив содержит элемент, больший 6'); | ||
} | ||
}) | ||
}); | ||
|
||
describe('getPokerHand', () => { | ||
it('should throw error `Массив содержит элемент, меньший 1` for [0, 2, 3, 4, 2]', () => { | ||
try{ | ||
const actual = getPokerHand([0, 2, 3, 4, 2]); | ||
throw new Error('`getPokerHand` should throw error'); | ||
} catch (error) { | ||
assert.equal(error.message, 'Массив содержит элемент, меньший 1'); | ||
} | ||
}) | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А можно ограничиться только одной проверкой?
То есть не два числа проверять, а только одно во всех случаях?