Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
fix(test): use default undername count in records test
Browse files Browse the repository at this point in the history
  • Loading branch information
atticusofsparta committed Aug 22, 2023
1 parent 2d92f5b commit cedbfa1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions schemas/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { buyRecordSchema } = require('./buyRecord');
const { auctionBidSchema } = require('./auction');
const { increaseUndernameCountSchema } = require('./undernames');

module.exports = {
auctionBidSchema,
buyRecordSchema,
Expand Down
4 changes: 1 addition & 3 deletions schemas/undernames.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const { MAX_ALLOWED_UNDERNAMES, DEFAULT_UNDERNAME_COUNT } = require("../src/constants");

const increaseUndernameCountSchema = {
$id: '#/definitions/increaseUndernameCount',
type: 'object',
Expand All @@ -15,7 +13,7 @@ const increaseUndernameCountSchema = {
qty: {
type: 'number',
minimum: 1,
maximum: MAX_ALLOWED_UNDERNAMES - DEFAULT_UNDERNAME_COUNT
maximum: 9990, // should be updated with contants "DEFAULT_UNDERNAME_COUNT" and "MAX_ALLOWED_UNDERNAMES"
},
},
required: ['name', 'qty'],
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const PERMABUY_LEASE_FEE_LENGTH = 10;
export const ALLOWED_ACTIVE_TIERS = [1, 2, 3];
export const ANNUAL_PERCENTAGE_FEE = 0.1; // 10% of cost of name
export const DEFAULT_UNDERNAME_COUNT = 10;
export const MAX_ALLOWED_UNDERNAMES = 10_000;
export const MAX_ALLOWED_UNDERNAMES = 10_000; // when modifying these, update the undernames schema
export const UNDERNAME_REGISTRATION_IO_FEE = 1; // 1 IO token per undername
export const NON_CONTRACT_OWNER_MESSAGE = `Caller is not the owner of the ArNS!`;
export const INVALID_ARNS_NAME_MESSAGE = 'Invalid ArNS Record Name';
Expand Down
11 changes: 6 additions & 5 deletions tests/records.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { arweave, warp } from './setup.jest';
import {
ANT_CONTRACT_IDS,
ARNS_NAME_RESERVED_MESSAGE,
DEFAULT_UNDERNAME_COUNT,
INVALID_INPUT_MESSAGE,
INVALID_SHORT_NAME,
INVALID_TIER_MESSAGE,
Expand Down Expand Up @@ -62,7 +63,7 @@ describe('Records', () => {
endTimestamp: expect.any(Number),
startTimestamp: expect.any(Number),
contractTxID: expect.any(String),
undernames: expect.any(Number),
undernames: DEFAULT_UNDERNAME_COUNT,
};
expect(record).not.toBe(undefined);
expect(record).toEqual(expectObjected);
Expand Down Expand Up @@ -120,7 +121,7 @@ describe('Records', () => {
tier: tiers.current[0],
endTimestamp: expect.any(Number),
startTimestamp: expect.any(Number),
undernames: expect.any(Number),
undernames: DEFAULT_UNDERNAME_COUNT,
type: 'lease',
});
expect(balances[nonContractOwnerAddress]).toEqual(
Expand Down Expand Up @@ -170,7 +171,7 @@ describe('Records', () => {
tier: tiers.current[0],
endTimestamp: expect.any(Number),
startTimestamp: expect.any(Number),
undernames: expect.any(Number),
undernames: DEFAULT_UNDERNAME_COUNT,
type: 'lease',
});
expect(balances[nonContractOwnerAddress]).toEqual(
Expand Down Expand Up @@ -220,7 +221,7 @@ describe('Records', () => {
tier: tiers.current[0],
type: 'permabuy',
startTimestamp: expect.any(Number),
undernames: expect.any(Number),
undernames: DEFAULT_UNDERNAME_COUNT,
});
expect(balances[nonContractOwnerAddress]).toEqual(
prevBalance - expectedPurchasePrice,
Expand Down Expand Up @@ -752,7 +753,7 @@ describe('Records', () => {
tier: tiers.current[0],
endTimestamp: expect.any(Number),
startTimestamp: expect.any(Number),
undernames: expect.any(Number),
undernames: DEFAULT_UNDERNAME_COUNT,
type: 'lease',
});
expect(cachedValue.errorMessages[writeInteraction!.originalTxId]).toBe(
Expand Down

0 comments on commit cedbfa1

Please sign in to comment.