This repository was archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinitializeJavaApp.test.js
67 lines (62 loc) · 2.78 KB
/
initializeJavaApp.test.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
59
60
61
62
63
64
65
66
67
'use strict'
const Initializer = require('../lib/InitializeJavaAppClass')
const expect = require('expect')
const initializerObj = new Initializer()
const fs = require('fs')
const { spawnSync } = require('child_process')
// const path = require('path')
// const { childProcess } = require('./util-functions')
describe.skip('initialize module', function() {
this.timeout(50000)
context('On calling initialize', function() {
it('ear folder is not present', async function() {
spawnSync('rm', ['-rf', '../ear'])
expect(await initializerObj.__isDir('../ear')).toBe(false)
})
})
context('On calling initialize', function() {
it('ear folder is present', async function() {
fs.mkdirSync('../ear')
expect(await initializerObj.__isDir('../ear')).toBe(true)
})
})
context('On calling initialize', function() {
it('ear folder is created', async function() {
spawnSync('rm', ['-rf', '../ear'])
spawnSync('rm', ['-rf', '.pipeline'])
fs.mkdirSync('../src')
fs.mkdirSync('.pipeline')
fs.mkdirSync('.pipeline/node_modules')
fs.mkdirSync('.pipeline/node_modules/nr-pipeline-ext')
fs.mkdirSync('.pipeline/node_modules/nr-pipeline-ext/lib')
fs.mkdirSync('.pipeline/node_modules/nr-pipeline-ext/lib/templates')
fs.mkdirSync('.pipeline/node_modules/nr-pipeline-ext/lib/templates/.pipeline')
await initializerObj.initialize()
expect(await initializerObj.__isDir('../ear/src')).toBe(true)
spawnSync('rm', ['-rf', '.pipeline', '../ear', '../src'])
})
})
context('On calling initialize', function() {
it('src folder is not present', function() {
spawnSync('rm', ['-rf', '../src'])
spawnSync('rm', ['-rf', '../ear'])
spawnSync('rm', ['-rf', '.pipeline'])
expect(async () => initializerObj.initialize()).toThrow()
spawnSync('rm', ['-rf', '.pipeline'])
})
})
context('On calling initialize', function() {
it('.pipeline folder is synced', async function() {
spawnSync('rm', ['-rf', '.pipeline'])
fs.mkdirSync('.pipeline')
fs.mkdirSync('.pipeline/node_modules')
fs.mkdirSync('.pipeline/node_modules/nr-pipeline-ext')
fs.mkdirSync('.pipeline/node_modules/nr-pipeline-ext/lib')
fs.mkdirSync('.pipeline/node_modules/nr-pipeline-ext/lib/templates')
fs.mkdirSync('.pipeline/node_modules/nr-pipeline-ext/lib/templates/.pipeline')
await initializerObj.__initializePipelineFolder()
expect(initializerObj.__isDir('.pipeline')).toBe(true)
spawnSync('rm', ['-rf', '.pipeline'])
})
})
})