This repository has been archived by the owner on Nov 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.spec.js
58 lines (57 loc) · 1.63 KB
/
create.spec.js
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
49
50
51
52
53
54
55
56
57
58
import create from './create.js'
import { CASE, FEATURE, MODULE } from '../../spec-section/_enums/type/spec-section.type.enum.js'
import fs from 'fs/promises'
import { PROJECT_PATH } from '../../global/_enums/names/global.names.enum.js'
export default {
type: MODULE,
group: [
{
type: FEATURE,
label: 'Create a folder to given path',
group: [
{
type: CASE,
label: 'Create a folder in an existing folder (nesting 1)',
test: async () => {
const path = '_tests/folder-create-in-existing'
await create(path)
try {
await fs.stat(global[PROJECT_PATH] + '/' + path)
return true
} catch {
return false
}
}
},
{
type: CASE,
label: 'Create a folder in a non-existing folder (nesting 2)',
test: async () => {
const path = '_tests/folder-create-in-non-existing-2/temp'
await create(path)
try {
await fs.stat(global[PROJECT_PATH] + '/' + path)
return true
} catch {
return false
}
}
},
{
type: CASE,
label: 'Create a folder in a non-existing folder (nesting 5)',
test: async () => {
const path = '_tests/folder-create-in-non-existing-5/a/b/c/temp'
await create(path)
try {
await fs.stat(global[PROJECT_PATH] + '/' + path)
return true
} catch {
return false
}
}
}
]
}
]
}