mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
added test of registration of service agreement templates
This commit is contained in:
parent
575b45b68a
commit
8bce68a3a5
@ -3,4 +3,4 @@
|
||||
--full-trace
|
||||
--exit
|
||||
--timeout 300000
|
||||
integration/**/*.test.ts
|
||||
integration/ocean/RegisterServiceAgreementTemplates.test.ts integration/**/*.test.ts
|
||||
|
28
integration/ocean/RegisterServiceAgreementTemplates.test.ts
Normal file
28
integration/ocean/RegisterServiceAgreementTemplates.test.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { assert } from 'chai'
|
||||
|
||||
import { config } from "../config"
|
||||
|
||||
import { Ocean, Account, ServiceAgreementTemplate, Templates } from '../../src' // @oceanprotocol/squid
|
||||
|
||||
describe("Register Service Agreement Templates", () => {
|
||||
let ocean: Ocean
|
||||
|
||||
let templateOwner: Account
|
||||
|
||||
before(async () => {
|
||||
ocean = await Ocean.getInstance(config)
|
||||
|
||||
// Accounts
|
||||
templateOwner = (await ocean.accounts.list())[0]
|
||||
})
|
||||
|
||||
it("should regiester a template", async () => {
|
||||
const serviceAgreementTemplate = new ServiceAgreementTemplate(new Templates.Access())
|
||||
const serviceAgreementRegistered = await serviceAgreementTemplate.register(templateOwner.getId())
|
||||
|
||||
try {
|
||||
// It can fail because is already created
|
||||
assert.isTrue(serviceAgreementRegistered, "Service agreement template not registered correctly")
|
||||
} catch (e) { }
|
||||
})
|
||||
})
|
@ -51,7 +51,7 @@ export default class ServiceAgreementTemplate extends OceanBase {
|
||||
return false
|
||||
}
|
||||
|
||||
if (!owner.getId().startsWith("0x0")) {
|
||||
if (!owner.getId().startsWith("0x00000")) {
|
||||
Logger.error(`Template with id "${this.template.id}" already registered by someone else.`)
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user