Skip to content

Commit

Permalink
LintTransformation tests added
Browse files Browse the repository at this point in the history
  • Loading branch information
nitro-marky committed Sep 11, 2023
1 parent 345a7a7 commit afa87a2
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@digicatapult/dscp-process-management",
"version": "1.7.47",
"version": "1.7.48",
"description": "DSCP Process Management Flow",
"main": "./lib/index.js",
"bin": {
Expand Down
97 changes: 93 additions & 4 deletions src/lib/process/_tests_/unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,106 @@ describe('listTranforming', () => {
const enriched: Process.RawPayload = {
...sample[0],
id: '123',
status: 'Disabled',
status: 'Enabled',
createdAtHash: 'abc',
initialU8aLength: '32',
}

const res = await listTransforming([enriched], processes, { ...defaultPolkadot, verbose: false })

expect(res[0])
.to.be.an('object')
.that.not.contain.keys(['program'])
console.log(res)

expect(res[0]).to.deep.contain({
id: '123',
status: 'Enabled',
version: 1,
})
})

it('returns all transformed processes with a program (--verbose=true)', async () => {
let processes: Process.RawPayload[]
const enriched: Process.RawPayload = {
...sample[0],
id: '123',
status: 'Disabled',
createdAtHash: 'abc',
initialU8aLength: '32',
}

const res = await listTransforming([enriched], processes, { ...defaultPolkadot, verbose: true})
console.log(res)
expect(res[0]).to.deep.contain({
id: '123',
status: 'Disabled',
version: 1,
})
})

it('returns all options active', async () => {
let processes: Process.RawPayload[]
const enriched: Process.RawPayload = {
...sample[0],
id: '123',
status: 'Enabled',
createdAtHash: 'abc',
initialU8aLength: '32',
}

const res = await listTransforming([enriched], processes, { ...defaultPolkadot, active: true})
console.log(res)
expect(res[0]).to.deep.contain({
id: '123',
status: 'Enabled',
version: 1,
})
})

it('returns all options disabled but with active true', async () => {
let processes: Process.RawPayload[]
const enriched: Process.RawPayload = {
...sample[0],
id: '123',
status: 'Disabled',
createdAtHash: 'abc',
initialU8aLength: '32',
}

const res = await listTransforming([enriched], processes, { ...defaultPolkadot, active: true})
console.log(res)
expect(res[0]).to.equal(undefined)
})

it('returns all options disabled', async () => {
let processes: Process.RawPayload[]
const enriched: Process.RawPayload = {
...sample[0],
id: '123',
status: 'Disabled',
createdAtHash: 'abc',
initialU8aLength: '32',
}

const res = await listTransforming([enriched], processes, { ...defaultPolkadot})
console.log(res)
expect(res[0]).to.deep.contain({
id: '123',
status: 'Disabled',
version: 1,
})
})

it('returns all options active with status enabled', async () => {
let processes: Process.RawPayload[]
const enriched: Process.RawPayload = {
...sample[0],
id: '123',
status: 'Disabled',
createdAtHash: 'abc',
initialU8aLength: '32',
}

const res = await listTransforming([enriched], processes, { ...defaultPolkadot, active: false})
console.log(res)
expect(res[0]).to.deep.contain({
id: '123',
status: 'Disabled',
Expand Down

0 comments on commit afa87a2

Please sign in to comment.