chore: add negative test for ATA creation with off-curve owner
This commit is contained in:
parent
7320cf404b
commit
3d04aa0109
|
@ -0,0 +1,32 @@
|
|||
// flow-typed signature: 81268811ffa24a5fec63585e3a703215
|
||||
// flow-typed version: <<STUB>>/chai-as-promised_v7.1.1/flow_v0.145.0
|
||||
|
||||
/**
|
||||
* This is an autogenerated libdef stub for:
|
||||
*
|
||||
* 'chai-as-promised'
|
||||
*
|
||||
* Fill this stub out by replacing all the `any` types.
|
||||
*
|
||||
* Once filled out, we encourage you to share your work with the
|
||||
* community by sending a pull request to:
|
||||
* https://github.com/flowtype/flow-typed
|
||||
*/
|
||||
|
||||
declare module 'chai-as-promised' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* We include stubs for each file inside this npm package in case you need to
|
||||
* require those files directly. Feel free to delete any files that aren't
|
||||
* needed.
|
||||
*/
|
||||
declare module 'chai-as-promised/lib/chai-as-promised' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
// Filename aliases
|
||||
declare module 'chai-as-promised/lib/chai-as-promised.js' {
|
||||
declare module.exports: $Exports<'chai-as-promised/lib/chai-as-promised'>;
|
||||
}
|
|
@ -36,6 +36,7 @@
|
|||
"@typescript-eslint/parser": "^4.14.2",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"chai": "^4.3.0",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"eslint": "^7.4.0",
|
||||
"eslint-plugin-flowtype": "^5.3.1",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
|
@ -4912,6 +4913,18 @@
|
|||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/chai-as-promised": {
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
|
||||
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"check-error": "^1.0.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"chai": ">= 2.1.2 < 5"
|
||||
}
|
||||
},
|
||||
"node_modules/chai/node_modules/deep-eql": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
|
||||
|
@ -16924,6 +16937,15 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"chai-as-promised": {
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
|
||||
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"check-error": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"chainsaw": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz",
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
"@typescript-eslint/parser": "^4.14.2",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"chai": "^4.3.0",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"eslint": "^7.4.0",
|
||||
"eslint-plugin-flowtype": "^5.3.1",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
// @flow
|
||||
import {expect} from 'chai';
|
||||
import chai from 'chai';
|
||||
import chaiAsPromised from 'chai-as-promised';
|
||||
import {Account, PublicKey} from '@solana/web3.js';
|
||||
|
||||
import {ASSOCIATED_TOKEN_PROGRAM_ID, Token, TOKEN_PROGRAM_ID} from '../client/token';
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
const expect = chai.expect;
|
||||
|
||||
describe('Token', () => {
|
||||
it('createTransfer', () => {
|
||||
const ix = Token.createTransferCheckedInstruction(
|
||||
|
@ -42,6 +46,12 @@ describe('Token', () => {
|
|||
expect(associatedPublicKey.toString()).to.eql(
|
||||
new PublicKey('DShWnroshVbeUp28oopA3Pu7oFPDBtC1DBmPECXXAQ9n').toString(),
|
||||
);
|
||||
await expect(Token.getAssociatedTokenAddress(
|
||||
ASSOCIATED_TOKEN_PROGRAM_ID,
|
||||
TOKEN_PROGRAM_ID,
|
||||
new PublicKey('7o36UsWR1JQLpZ9PE2gn9L4SQ69CNNiWAXd4Jt7rqz9Z'),
|
||||
associatedPublicKey,
|
||||
)).to.be.rejectedWith(`Owner cannot sign: ${associatedPublicKey.toString()}`);
|
||||
});
|
||||
|
||||
it('createAssociatedTokenAccount', () => {
|
||||
|
|
Loading…
Reference in New Issue