stakwork / sphinx-tribes

Backend for sphinx tribes and bounties. The bounty platform pays out in bitcoin. Sign up with Sphinx Chat, complete a bounty, and earn bitcoin! Go to our website for available bounties.
https://community.sphinx.chat/bounties
33 stars 60 forks source link

[Bounty Creation Unit Test] Create mock data for bounty creation #996

Closed elraphty closed 10 months ago

elraphty commented 11 months ago

Create mock data for unit tests for bounty creation:

Bounty interface

export interface PersonBounty {
  person?: any;
  body?: any;
  org_uuid?: any;
  title?: string;
  description?: string;
  owner_id: string;
  created?: number;
  show?: boolean;
  assignee?: any;
  wanted_type: string;
  type?: string;
  price?: string;
  codingLanguage: string;
  estimated_session_length: string;
  bounty_expires?: string;
  commitment_fee?: number;
}

The getPeopleBounties function in store/main.ts makes an API query to get all bounties, write a test that mocks the get bounties endpoint when bounties are listed it should be persisted to the peopleBounties localStorage.

The saveBounty function in store/main.ts makes an API query to add a new bounty, write a test that mocks the save bounty endpoint when a new bounty is saved it should be added and persisted to the peopleBounties localStorage.

The getBountyById function in store/main.ts makes an API query to get a single bounty, write a test that mocks the get bounty by Id endpoint after a successful request the bounty, you should ascertain that the return bounty matches the bounty in peopleBounties array in local storage with the same bounty id.

The deleteBounty function in store/main.ts makes an API query to delete a bounty, write a test that mocks the delete bounty endpoint after a successful delete the bounty should be removed from `people bounties localStorage.

Khaalid-oh commented 11 months ago

PR: https://github.com/stakwork/sphinx-tribes/pull/1156

ecurrencyhodler commented 10 months ago

Closed by #1156