@xyo-network/witness-environment 5.1.22 → 5.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/witness-environment",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.24",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -30,24 +30,27 @@
|
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
|
-
"src"
|
|
33
|
+
"src",
|
|
34
|
+
"!**/*.bench.*",
|
|
35
|
+
"!**/*.spec.*",
|
|
36
|
+
"!**/*.test.*"
|
|
34
37
|
],
|
|
35
38
|
"dependencies": {
|
|
36
|
-
"@xylabs/object": "~5.0.
|
|
37
|
-
"@xyo-network/abstract-witness": "~5.1.
|
|
38
|
-
"@xyo-network/module-model": "~5.1.
|
|
39
|
-
"@xyo-network/payload-model": "~5.1.
|
|
40
|
-
"@xyo-network/value-payload-plugin": "~5.1.
|
|
41
|
-
"@xyo-network/witness-model": "~5.1.
|
|
39
|
+
"@xylabs/object": "~5.0.37",
|
|
40
|
+
"@xyo-network/abstract-witness": "~5.1.24",
|
|
41
|
+
"@xyo-network/module-model": "~5.1.24",
|
|
42
|
+
"@xyo-network/payload-model": "~5.1.24",
|
|
43
|
+
"@xyo-network/value-payload-plugin": "~5.1.24",
|
|
44
|
+
"@xyo-network/witness-model": "~5.1.24"
|
|
42
45
|
},
|
|
43
46
|
"devDependencies": {
|
|
44
47
|
"@xylabs/ts-scripts-yarn3": "~7.2.8",
|
|
45
48
|
"@xylabs/tsconfig": "~7.2.8",
|
|
46
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
47
|
-
"@xyo-network/account": "~5.1.
|
|
48
|
-
"@xyo-network/payload-builder": "~5.1.
|
|
49
|
+
"@xylabs/vitest-extended": "~5.0.37",
|
|
50
|
+
"@xyo-network/account": "~5.1.24",
|
|
51
|
+
"@xyo-network/payload-builder": "~5.1.24",
|
|
49
52
|
"typescript": "~5.9.3",
|
|
50
|
-
"vitest": "~4.0.
|
|
53
|
+
"vitest": "~4.0.10"
|
|
51
54
|
},
|
|
52
55
|
"publishConfig": {
|
|
53
56
|
"access": "public"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Witness.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Witness.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
package/src/spec/Witness.spec.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import '@xylabs/vitest-extended'
|
|
2
|
-
|
|
3
|
-
import { Account } from '@xyo-network/account'
|
|
4
|
-
import { isValuePayload } from '@xyo-network/value-payload-plugin'
|
|
5
|
-
import {
|
|
6
|
-
beforeAll,
|
|
7
|
-
describe, expect, it,
|
|
8
|
-
} from 'vitest'
|
|
9
|
-
|
|
10
|
-
import { EnvironmentWitnessConfigSchema } from '../Config.ts'
|
|
11
|
-
import type { EnvironmentSubset } from '../Payload.ts'
|
|
12
|
-
import { EnvironmentSubsetSchema } from '../Payload.ts'
|
|
13
|
-
import { EnvironmentWitness } from '../Witness.ts'
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @group witness
|
|
17
|
-
* @group module
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
describe('EnvironmentWitness', () => {
|
|
21
|
-
let sut: EnvironmentWitness
|
|
22
|
-
beforeAll(async () => {
|
|
23
|
-
const config = { schema: EnvironmentWitnessConfigSchema }
|
|
24
|
-
const account = await Account.random()
|
|
25
|
-
sut = await EnvironmentWitness.create({ account, config })
|
|
26
|
-
})
|
|
27
|
-
describe('witness', () => {
|
|
28
|
-
describe('without template payload', () => {
|
|
29
|
-
it('should return the environment', async () => {
|
|
30
|
-
const result = await sut.observe()
|
|
31
|
-
expect(result).toBeArrayOfSize(1)
|
|
32
|
-
const env = result.find(isValuePayload)
|
|
33
|
-
expect(env).toBeDefined()
|
|
34
|
-
expect(env?.value).toBeDefined()
|
|
35
|
-
// NOTE: Due to how we sanitize __ fields from payloads
|
|
36
|
-
// this test can fail on systems where __ fields are present
|
|
37
|
-
// in the environment so we'll sanitize those when comparing
|
|
38
|
-
const processEnv = process.env
|
|
39
|
-
expect(env?.value).toEqual(processEnv)
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
describe('with subset payload', () => {
|
|
43
|
-
it('should return only the environment subset', async () => {
|
|
44
|
-
type EnvironmentWithPath = { PATH: string }
|
|
45
|
-
const template: EnvironmentSubset = { schema: EnvironmentSubsetSchema, values: ['PATH'] }
|
|
46
|
-
const result = await sut.observe([template])
|
|
47
|
-
expect(result).toBeArrayOfSize(1)
|
|
48
|
-
const env = result.find(isValuePayload)
|
|
49
|
-
expect(env).toBeDefined()
|
|
50
|
-
expect(env?.value).toContainAllKeys(template.values)
|
|
51
|
-
expect((env?.value as EnvironmentWithPath)?.PATH).toEqual(process.env.PATH)
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
})
|
|
55
|
-
})
|