-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
111 additions
and
3 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
src/builders/__tests__/__snapshots__/open-action.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Given the "openAction" metadata builder when using it should return a valid OpenActionMetadata 1`] = ` | ||
{ | ||
"$schema": "https://json-schemas.lens.dev/open-actions/1.0.0.json", | ||
"attributes": [ | ||
{ | ||
"key": "twitter", | ||
"type": "String", | ||
"value": "https://twitter.com/johndoe", | ||
}, | ||
{ | ||
"key": "dob", | ||
"type": "String", | ||
"value": "1990-01-01T00:00:00Z", | ||
}, | ||
], | ||
"authors": [ | ||
"[email protected]", | ||
], | ||
"description": " | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. | ||
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
- Donec a diam lectus. | ||
", | ||
"initializeABI": [ | ||
{ | ||
"indexed": true, | ||
"name": "address", | ||
"type": "address", | ||
}, | ||
{ | ||
"indexed": true, | ||
"name": "price", | ||
"type": "uint256", | ||
}, | ||
], | ||
"name": "Open Action Name", | ||
"processABI": [ | ||
{ | ||
"indexed": true, | ||
"name": "collector", | ||
"type": "address", | ||
}, | ||
], | ||
"title": "Open Action Title", | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { describe, expect, it } from '@jest/globals'; | ||
|
||
import { MetadataAttributeType } from '../../MetadataAttribute.js'; | ||
import { openAction } from '../open-action'; | ||
import { faker } from '@faker-js/faker'; | ||
import { Markdown } from '../../primitives'; | ||
|
||
describe(`Given the "${openAction.name}" metadata builder`, () => { | ||
describe(`when using it`, () => { | ||
it('should return a valid OpenActionMetadata', () => { | ||
const metadata = openAction({ | ||
name: 'Open Action Name', | ||
title: 'Open Action Title', | ||
authors: [faker.internet.email()], | ||
attributes: [ | ||
{ | ||
key: 'twitter', | ||
type: MetadataAttributeType.STRING, | ||
value: 'https://twitter.com/johndoe', | ||
}, | ||
{ | ||
key: 'dob', | ||
type: MetadataAttributeType.STRING, | ||
value: '1990-01-01T00:00:00Z', | ||
}, | ||
], | ||
description: ` | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. | ||
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
- Donec a diam lectus. | ||
` as Markdown, | ||
initializeABI: [ | ||
{ | ||
type: 'address', | ||
name: 'address', | ||
indexed: true, | ||
}, | ||
{ | ||
type: 'uint256', | ||
name: 'price', | ||
indexed: true, | ||
}, | ||
], | ||
processABI: [ | ||
{ | ||
type: 'address', | ||
name: 'collector', | ||
indexed: true, | ||
}, | ||
], | ||
}); | ||
|
||
expect(metadata).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters