Skip to content

Commit

Permalink
test: integration tests on esm
Browse files Browse the repository at this point in the history
  • Loading branch information
rflechtner committed Jul 20, 2023
1 parent 8a02ad6 commit 759a82b
Show file tree
Hide file tree
Showing 16 changed files with 858 additions and 1,232 deletions.
3 changes: 2 additions & 1 deletion babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
[
"@babel/preset-env",
{
"modules": "commonjs"
"modules": "commonjs",
"targets": {"node": "current"}
}
]
]
Expand Down
3 changes: 1 addition & 2 deletions jest-setup/setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { cryptoWaitReady } from '@polkadot/util-crypto'
export {}
const { cryptoWaitReady } = require('@polkadot/util-crypto')

beforeAll(async () => {
await cryptoWaitReady()
Expand Down
20 changes: 20 additions & 0 deletions jest.config.integration.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
testEnvironment: 'node',
clearMocks: true,
// Parachain block time is 12s
testTimeout: 30000,
maxWorkers: 3,
rootDir: 'tests/integration/dist',
transform: {},
coverageDirectory: 'coverage',
moduleDirectories: [
"node_modules",
],
coveragePathIgnorePatterns: [
"/node_modules/",
"packages/testing",
"packages/type-definitions",
"packages/types",
"packages/augment-api"
]
}
3 changes: 2 additions & 1 deletion jest.config.integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module.exports = {
// Parachain block time is 12s
testTimeout: 30000,
maxWorkers: 3,
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/|@digitalbazaar|base.+-universal|crypto-ld)'],
testPathIgnorePatterns: ['dist'],
transformIgnorePatterns: ['/node_modules/(?!@digitalbazaar|base.+-universal|crypto-ld)'],
transform: {
"\\.js$": "babel-jest",
"\\.ts$": "ts-jest"
Expand Down
8 changes: 3 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
clearMocks: true,
runner: 'groups',
// Parachain block time is 12s
testTimeout: 15000,
testTimeout: 5000,
setupFilesAfterEnv: ['../jest-setup/setup.js'],
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/|@digitalbazaar|base.+-universal|crypto-ld)'],
transformIgnorePatterns: ['/node_modules/(?!@digitalbazaar|base.+-universal|crypto-ld)'],
coverageThreshold: {
global: {
branches: 70,
Expand All @@ -16,7 +14,7 @@ module.exports = {
},
},
transform: {
"\\.js$": "babel-jest",
"\\.js$": ["babel-jest", { root: './' }],
"\\.ts$": "ts-jest"
},
collectCoverageFrom: [
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"test:breaking": "jest --group=breaking",
"test:ci": "yarn test --ci --forceExit",
"test:integration": "jest -c jest.config.integration.js",
"test:integration:esm": "tsc -p tests/integration/tsconfig.esm.json && yarn node --experimental-vm-modules $(yarn bin jest) -c jest.config.integration.esm.js",
"test:integration:ci": "yarn test:integration -b --testTimeout=60000",
"test:integration:latest-develop": "TESTCONTAINERS_NODE_IMG=kiltprotocol/mashnet-node:latest-develop yarn test:integration",
"test:watch": "yarn test --watch",
Expand All @@ -47,7 +48,7 @@
"@commitlint/cli": "^9.0.1",
"@commitlint/config-conventional": "^9.0.1",
"@playwright/test": "^1.21.1",
"@types/jest": "^27.4.0",
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^5.7.0",
"@typescript-eslint/parser": "^5.7.0",
"eslint": "^7.32.0",
Expand All @@ -58,15 +59,14 @@
"eslint-plugin-license-header": "^0.2.1",
"eslint-plugin-prettier": "^3.4.1",
"husky": "^4.2.5",
"jest": "^27.4.7",
"jest-docblock": "^27.4.0",
"jest-runner": "^27.4.6",
"jest-runner-groups": "^2.1.0",
"jest": "^29.6.1",
"jest-runner": "^29.6.1",
"jest-runner-groups": "^2.2.0",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"testcontainers": "^9.0.0",
"ts-jest": "^27.1.2",
"ts-jest-resolver": "^2.0.0",
"ts-jest": "^29.1.1",
"ts-jest-resolver": "^2.0.1",
"typedoc": "^0.23.0",
"typescript": "^4.8.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/balance/Balance.utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ describe('toFemtoKilt', () => {
expect(() =>
toFemtoKilt('-0.0000001', 'nano').toString()
).toThrowErrorMatchingInlineSnapshot(
`"Too many decimal places: input with unit \\"nano\\" and value \\"-0.0000001\\" exceeds the 6 possible decimal places by 1"`
`"Too many decimal places: input with unit "nano" and value "-0.0000001" exceeds the 6 possible decimal places by 1"`
)
expect(toFemtoKilt('-0').toString()).toEqual(new BN('0').toString())
expect(toFemtoKilt('-0.000001', 'nano').toString()).toEqual(
Expand Down
18 changes: 9 additions & 9 deletions packages/core/src/claim/Claim.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ describe('jsonld', () => {
// this is what a kilt claim looks like when expressed in expanded JSON-LD
const jsonld = Claim.toJsonLD(claim, true)
expect(jsonld).toMatchInlineSnapshot(`
Object {
"https://www.w3.org/2018/credentials#credentialSchema": Object {
{
"https://www.w3.org/2018/credentials#credentialSchema": {
"@id": "kilt:ctype:0x90364302f3b6ccfa50f3d384ec0ab6369711e13298ba4a5316d7e2addd5647b2",
},
"https://www.w3.org/2018/credentials#credentialSubject": Object {
"https://www.w3.org/2018/credentials#credentialSubject": {
"@id": "did:kilt:4r1WkS3t8rbCb11H8t3tJvGVCynwDXSUBiuGB6sLRHzCLCjs",
"kilt:ctype:0x90364302f3b6ccfa50f3d384ec0ab6369711e13298ba4a5316d7e2addd5647b2#address": "homestreet, home",
"kilt:ctype:0x90364302f3b6ccfa50f3d384ec0ab6369711e13298ba4a5316d7e2addd5647b2#name": "John",
Expand All @@ -50,15 +50,15 @@ describe('jsonld', () => {
// this is what a kilt claim looks like when expressed in compact JSON-LD
const jsonld = Claim.toJsonLD(claim, false)
expect(jsonld).toMatchInlineSnapshot(`
Object {
"@context": Object {
{
"@context": {
"@vocab": "https://www.w3.org/2018/credentials#",
},
"credentialSchema": Object {
"credentialSchema": {
"@id": "kilt:ctype:0x90364302f3b6ccfa50f3d384ec0ab6369711e13298ba4a5316d7e2addd5647b2",
},
"credentialSubject": Object {
"@context": Object {
"credentialSubject": {
"@context": {
"@vocab": "kilt:ctype:0x90364302f3b6ccfa50f3d384ec0ab6369711e13298ba4a5316d7e2addd5647b2#",
},
"@id": "did:kilt:4r1WkS3t8rbCb11H8t3tJvGVCynwDXSUBiuGB6sLRHzCLCjs",
Expand Down Expand Up @@ -93,7 +93,7 @@ describe('jsonld', () => {
})
expect(hashed.nonceMap).toEqual(nonceMap)
expect(hashed.hashes).toMatchInlineSnapshot(`
Array [
[
"0x3c2ae125a0baf4ed64a30b7ad012810b4622628a2eb5ad32e769e6a1d356d58d",
"0x69aae66efd954c3712e91dd2761dab08ea941e6516e7cf6ddf6e3b90ddc5bdf3",
"0x8d5736197583931c4e4d3dce0503596760f7a13e8187cc440b7de1edd4370d6a",
Expand Down
54 changes: 27 additions & 27 deletions packages/did/src/DidDocumentExporter/DidDocumentExporter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,42 +231,42 @@ describe('When exporting a DID Document from a light DID', () => {
const didDoc = exportToDidDocument(lightDid, 'application/json')

expect(didDoc).toMatchInlineSnapshot(`
Object {
"authentication": Array [
{
"authentication": [
"did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf#authentication",
],
"id": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf",
"keyAgreement": Array [
"keyAgreement": [
"did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf#encryption",
],
"service": Array [
Object {
"service": [
{
"id": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf#id-1",
"serviceEndpoint": Array [
"serviceEndpoint": [
"x:url-id-1",
],
"type": Array [
"type": [
"type-id-1",
],
},
Object {
{
"id": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf#id-2",
"serviceEndpoint": Array [
"serviceEndpoint": [
"x:url-id-2",
],
"type": Array [
"type": [
"type-id-2",
],
},
],
"verificationMethod": Array [
Object {
"verificationMethod": [
{
"controller": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf",
"id": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf#authentication",
"publicKeyBase58": "11111111111111111111111111111111",
"type": "Ed25519VerificationKey2018",
},
Object {
{
"controller": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf",
"id": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf#encryption",
"publicKeyBase58": "11111111111111111111111111111111",
Expand All @@ -281,46 +281,46 @@ describe('When exporting a DID Document from a light DID', () => {
const didDoc = exportToDidDocument(lightDid, 'application/ld+json')

expect(didDoc).toMatchInlineSnapshot(`
Object {
"@context": Array [
{
"@context": [
"https://www.w3.org/ns/did/v1",
"ipfs://QmU7QkuTCPz7NmD5bD7Z7mQVz2UsSPaEK58B5sYnjnPRNW",
],
"authentication": Array [
"authentication": [
"did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf#authentication",
],
"id": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf",
"keyAgreement": Array [
"keyAgreement": [
"did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf#encryption",
],
"service": Array [
Object {
"service": [
{
"id": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf#id-1",
"serviceEndpoint": Array [
"serviceEndpoint": [
"x:url-id-1",
],
"type": Array [
"type": [
"type-id-1",
],
},
Object {
{
"id": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf#id-2",
"serviceEndpoint": Array [
"serviceEndpoint": [
"x:url-id-2",
],
"type": Array [
"type": [
"type-id-2",
],
},
],
"verificationMethod": Array [
Object {
"verificationMethod": [
{
"controller": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf",
"id": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf#authentication",
"publicKeyBase58": "11111111111111111111111111111111",
"type": "Ed25519VerificationKey2018",
},
Object {
{
"controller": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf",
"id": "did:kilt:light:014nv4phaKc4EcwENdRERuMF79ZSSB5xvnAk3zNySSbVbXhSwS:z16QMTH1Pc4A99Und9RZvzyikFR73Aepx9exPZPgXJX18upeuSpgXeat2LsjEQpXUBUtaRtdpSXpv42KitoFqySLjiuXVcghuoWviPci3QrnQMeD161howeWdF5GTbBFRHSVXpEu9PWbtUEsnLfDf2NQgu4LmktN8Ti6CAmdQtQiVNbJkB7TnyzLiJJ27rYayWj15mjJ9EoNyyu3rDJGomi2vUgt2DiSUXaJbnSzuuFf#encryption",
"publicKeyBase58": "11111111111111111111111111111111",
Expand Down
4 changes: 2 additions & 2 deletions packages/utils/src/Crypto.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('helper functions', () => {
hashed = Crypto.hashStatements(statements, { nonceGenerator: () => '' })
expect(hashed.map((i) => i.digest)).toEqual(digests)
expect(hashed.map((i) => i.saltedHash)).toMatchInlineSnapshot(`
Array [
[
"0x3d4b9478848e85771d9d678f2d80966bf9ea36f0d05b44fe5b23433e14a3eace",
"0x56c8f25bc8a9a8921c756c41f47efceb12c8129a9569456f7d80955bfcec2dcf",
"0x46ee56523ea5289f05709c26f6be6b08f364a3f2d6a5a8b6cfb2839bfe6a506e",
Expand All @@ -112,7 +112,7 @@ describe('helper functions', () => {
})
expect(hashed.map((i) => i.digest)).toEqual(digests)
expect(hashed.map((i) => i.saltedHash)).toMatchInlineSnapshot(`
Array [
[
"0x7126bd9e273ae6a1b2cfdc5f987b0f862cf2db77fea9b017963fec83b328784d",
"0xda617d15abd22984c2f1927f4e23a101696b7495c83ac178bbb91818ec102117",
"0x4e31eef9054d0d8682707880a414b86fafaa963b19220d03273eae764ad0bc1d",
Expand Down
4 changes: 2 additions & 2 deletions packages/vc-export/src/CAIP/CAIP.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ it('parses a CAIP-2 chain id', () => {
`"polkadot:411f057b9107718c9624d6aa4a3f23c1"`
)
expect(parseCaip2(chainId)).toMatchInlineSnapshot(`
Object {
{
"chainNamespace": "polkadot",
"chainReference": "411f057b9107718c9624d6aa4a3f23c1",
}
Expand All @@ -37,7 +37,7 @@ it('throws if CAIP-2 identifier not valid', () => {
it('parses a CAIP-19 asset id', () => {
expect(parseCaip19('polkadot:1234567890abcdef/jabba:dabba/asset10'))
.toMatchInlineSnapshot(`
Object {
{
"assetId": "jabba:dabba/asset10",
"assetInstance": "asset10",
"assetNamespace": "jabba",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ describe('issuance', () => {
}
)
).rejects.toThrowErrorMatchingInlineSnapshot(
`"The document to be signed must contain this suite's @context, \\"https://www.kilt.io/contexts/credentials\\"."`
`"The document to be signed must contain this suite's @context, "https://www.kilt.io/contexts/credentials"."`
)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ it('generates a key', async () => {
expect(
key.export({ publicKey: true, privateKey: true, includeContext: true })
).toMatchInlineSnapshot(`
Object {
{
"@context": "https://www.kilt.io/contexts/credentials",
"controller": "Alice",
"id": "Alice/key",
Expand Down
8 changes: 5 additions & 3 deletions tests/integration/Balance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* @group integration/balance
*/

import { jest } from '@jest/globals'

import { ApiPromise } from '@polkadot/api'
import { BN } from '@polkadot/util'

Expand Down Expand Up @@ -66,7 +68,7 @@ describe('when there is a dev chain with a faucet', () => {
// in the other test cases.
it('should be able to faucet coins to a new address', async () => {
const address = addressFromRandom()
const spy = jest.fn()
const spy = jest.fn<any>()
api.query.system.account(address, spy)
const balanceBefore = (await api.query.system.account(faucet.address)).data
const transferTx = api.tx.balances.transfer(address, EXISTENTIAL_DEPOSIT)
Expand Down Expand Up @@ -140,7 +142,7 @@ describe('When there are haves and have-nots', () => {
}, 30_000)

it('should be able to make a new transaction once the last is ready', async () => {
const spy = jest.fn()
const spy = jest.fn<any>()
api.query.system.account(faucet.address, spy)

const transferTx1 = api.tx.balances.transfer(
Expand All @@ -158,7 +160,7 @@ describe('When there are haves and have-nots', () => {
}, 30_000)

it('should be able to make multiple transactions at once', async () => {
const listener = jest.fn()
const listener = jest.fn<any>()
api.query.system.account(faucet.address, listener)

const batch = api.tx.utility.batchAll([
Expand Down
9 changes: 9 additions & 0 deletions tests/integration/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"include": ["*.ts"],
"compilerOptions": {
"module": "ES6",
"baseUrl": "./",
"outDir": "dist"
}
}
Loading

0 comments on commit 759a82b

Please sign in to comment.