Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue-358: add test for migration with new fileds example #363

Merged

Conversation

fospring
Copy link
Contributor

@fospring fospring commented Sep 1, 2023

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • Commit messages follow the conventional commits spec
  • If this is a code change: I have written unit tests.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

Add example for migrate old contract structure to current structure with new added fileds

Test Plan

cd examples/src
pnpm run build:status-message
pnpm run build:status-message-migrate-add-field
pnpm run test:status-message-migrate-add-field

Test result:

Contract logs from dev-11117.test.near.set_status({"message":"hello"}) call: [ 'ali.test.near set_status with message hello' ]
Contract logs from dev-11117.test.near.get_status({"account_id":"ali.test.near"}) view call: [ 'get_status for account_id ali.test.near' ]
Contract logs from dev-11117.test.near.migrateState({}) call: [ 'records.length [object Object]' ]
Contract logs from dev-11117.test.near.get_status({"account_id":"ali.test.near"}) view call: [ 'get_status for account_id ali.test.near' ]
Contract logs from dev-11117.test.near.set_new_status({"message":"hello"}) call: [ 'ali.test.near set_new_status with message hello' ]
Contract logs from dev-11117.test.near.get_new_status({"account_id":"ali.test.near"}) view call: [ 'get_new_status for account_id ali.test.near' ]
  ✔ migration works (9.5s)
  ─

  1 test passed

Related issues/PRs

#358

@fospring
Copy link
Contributor Author

fospring commented Sep 1, 2023

The test failed with error message:

turbo run test
examples:test:   fungible-token-lockable.ava › afterEach.always hook for Transfer failures
examples:test: 
examples:test:   Rejected promise returned by test. Reason:
examples:test: 
examples:test:   TypeError {
examples:test:     message: 'Cannot read properties of undefined (reading \'tearDown\')',
examples:test:   }
examples:test: 
examples:test:   › file://__tests__/test-fungible-token-lockable.ava.js:32:26

quite strange

@ailisp
Copy link
Member

ailisp commented Sep 4, 2023

@fospring This PR looks great. The failure seems a flaky test in workspaces-js. It also happens sometimes locally. Can you create an issue and look into it?

@fospring
Copy link
Contributor Author

fospring commented Sep 4, 2023

@fospring This PR looks great. The failure seems a flaky test in workspaces-js. It also happens sometimes locally. Can you create an issue and look into it?

ok

@fospring
Copy link
Contributor Author

fospring commented Sep 9, 2023

@fospring This PR looks great. The failure seems a flaky test in workspaces-js. It also happens sometimes locally. Can you create an issue and look into it?

near/near-workspaces-js#215

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants