-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02.spec.js
More file actions
48 lines (39 loc) · 1.46 KB
/
Copy path02.spec.js
File metadata and controls
48 lines (39 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import {isSymmetric} from './02.js'
import {expect} from 'chai'
describe ("", () => {
it ("should return false for non-array input", () => {
const input = "chai with chocolate"
const result = isSymmetric(input)
expect(result).to.be.false
})
it ("should return true when array input is empty", () => {
const input = []
const result = isSymmetric(input)
expect(result).to.be.true
})
it ("should return true when array input has one element", () => {
const input = [5]
const result = isSymmetric(input)
expect(result).to.be.true
})
it ("should return false when array input has two non-symmetric elements", () => {
const input = [5, 8]
const result = isSymmetric(input)
expect(result).to.be.false
})
it ("should return true when array input has symmetric elements", () => {
const input = [5, 8, 8, 5]
const result = isSymmetric(input)
expect(result).to.be.true
})
it ("should return false when array input has symmetric elements ut one is not a numm", () => {
const input = [5, 8, "8", 5]
const result = isSymmetric(input)
expect(result).to.be.false
})
it ("should return false when array input is null", () => {
const input = null
const result = isSymmetric(input)
expect(result).to.be.false
})
})