├── .gitignore ├── README.md ├── index.js ├── package-lock.json ├── package.json └── test └── vjudge_api.test.js /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vjudge-api 2 | Unofficial [Vjudge](https://vjudge.net/) api library for nodejs. 3 | 4 | ## Install 5 | `$ npm install vjudge-api` 6 | 7 | ## Usage 8 | ``` 9 | //ES5 10 | var Vjudge = require('vjudge-api'); 11 | 12 | //ES2015 13 | import Vjudge from 'vjudge-api'; 14 | ``` 15 | ## Api 16 | Here's some api level functionalities with example. 17 | 18 | ### verdicts() 19 | Returns all the verdict expressions used in Vjudge. 20 | 21 | ``` 22 | console.log( Vjudge.verdicts() ); 23 | 24 | // result 25 | //{ 26 | // "All": 0, 27 | // "Accepted": 1, 28 | // "Presentation Error": 2, 29 | // "Wrong Answer": 3, 30 | // "Time Limit Exceed": 4, 31 | // "Memory Limit Exceed": 5, 32 | // "Output Limit Exceed": 6, 33 | // "Runtime Error": 7, 34 | // "Compile Error": 8, 35 | // "Unknown Error": 9, 36 | // "Submit Error": 10, 37 | // "Queuing && Judging": 11 38 | //} 39 | ``` 40 | ### remote_ojs() 41 | Returns all the Online Judges supported by Vjudge system along with their language supports(in json format). It's an asyncronus function. 42 | 43 | ``` 44 | Vjudge.remote_ojs().then(result => console.log(result)).catch(err => console.error(err)); 45 | 46 | // result 47 | //{ 48 | // SGU: { name: 'SGU', languages: {} }, 49 | // FZU: { 50 | // name: 'FZU', 51 | // languages: { 52 | // '0': 'GNU C++', 53 | // '1': 'GNU C', 54 | // '2': 'Pascal', 55 | // '3': 'Java', 56 | // '4': 'Visual C++', 57 | // '5': 'Visual C' 58 | // } 59 | // }, 60 | // UVA: { 61 | // name: 'UVA', 62 | // languages: { 63 | // '1': 'ANSI C 5.3.0', 64 | // '2': 'JAVA 1.8.0', 65 | // '3': 'C++ 5.3.0', 66 | // '4': 'PASCAL 3.0.0', 67 | // '5': 'C++11 5.3.0', 68 | // '6': 'PYTH3 3.5.1' 69 | // } 70 | // }, 71 | // // Tons of other informations like this :3 72 | //} 73 | ``` 74 | ### solve_count(options) 75 | Returns all the accepted and failed solution records for one user (problem-numbers along with online judges). It's an asyncronus function. 76 | 77 | ``` 78 | const options = { 79 | un: "rahathossain690" 80 | } 81 | Vjudge.solve_count(options).then(result => console.log(result)).catch(err => console.error(err)); 82 | 83 | // result 84 | //{ 85 | // acRecords: { 86 | // AtCoder: [ 'abc084_d', 'arc099_a', 'soundhound2018_summer_qual_b' ], 87 | // CodeChef: [ 'PRGIFT', 'DRAGNXOR' ], 88 | // CodeForces: [ 89 | // '58A', '21C', '66B', '66D', 90 | // '80A', '47A', '47B', '68A', 91 | // '68B', '11A', '50B', '131C', 92 | // '137A', '159A', '200B', '84B', 93 | // '289A', '315A', '376A', '379A', 94 | // '471A', '293A', '147A', '509A', 95 | // '575D', '805A', '862A', '926A', 96 | // '962C', '1006B', '1182B' 97 | // ], 98 | // // like this 99 | // }, 100 | // failRecords: { 101 | // AtCoder: [ 'arc100_a' ], 102 | // CodeForces: [ '429D', '862B', '1187C' ], 103 | // // like this 104 | // } 105 | //} 106 | ``` 107 | ### problems(options) 108 | Returns all informations about problems, Supports querying, Asynchronus function. 109 | 110 | ``` 111 | const options = { 112 | start: 0, // Start position from the problem-list, positive integer, default: 0 113 | length: 1, // Length of the output list, positive integer with maximum 100, default: 20 114 | sortDir: 'desc', // 'desc' or 'asc', default: 'desc' 115 | sortCol: 5, // Basis column for sorting, default: 5 116 | OJId: 'LightOJ', // Online judges, (List can be found from remote_ojs()), default: 'All' 117 | probNum: '1234', // Problem number in an online judge, default: '' (no specific problem) 118 | title: '', // Default: '' 119 | source: '', // Default: '' 120 | category: '' // Default: '' 121 | } 122 | 123 | Vjudge.problems(options).then(result => console.log(result)).catch(err => console.error(err)); 124 | 125 | // result 126 | // { 127 | // data: [ 128 | // { 129 | // originOJ: 'LightOJ', 130 | // originProb: '1234', 131 | // allowSubmit: true, 132 | // id: 26945, 133 | // source: '', 134 | // title: 'Harmonic Number', 135 | // triggerTime: 1602909550000, 136 | // isFav: 0, 137 | // status: 0 138 | // } 139 | // ], 140 | // recordsTotal: 9999999, 141 | // recordsFiltered: 9999999, 142 | // draw: 1 143 | // } 144 | ``` 145 | 146 | ### status(options) 147 | Returns submission status informations, supports querying. Asynchronus function. 148 | 149 | ``` 150 | const options = { 151 | start: 0, // Start position from the problem-list, positive integer, default: 0 152 | length: 1, // Length of the output list, positive integer with maximum 20, default: 20 153 | un: 'rahathossain690', // Username of any user, default: '' (no specific user) 154 | OJId: 'All', // Online judges, (List can be found from remote_ojs()), default: 'All' 155 | probNum: '', // Problem number in an online judge, default: '' (no specific problem) 156 | res: 1, // Vjudge verdict expression, default: 0 (verdicts() function might help) 157 | language: '', // Language of the submission, default: '' 158 | onlyFollowee: 'true' // Default: true 159 | } 160 | 161 | Vjudge.status(options).then(result => console.log(result)).catch(err => console.error(error)) 162 | 163 | // { 164 | // data: [ 165 | // { 166 | // memory: 2092, 167 | // access: 0, 168 | // statusType: 0, 169 | // runtime: 2, 170 | // language: 'C++', 171 | // statusCanonical: 'AC', 172 | // userName: 'rahathossain690', 173 | // userId: 227541, 174 | // languageCanonical: 'CPP', 175 | // contestId: 132789, 176 | // uDebugUrl: 'https://udebug.com/LOJ/1060', 177 | // contestNum: 'O', 178 | // processing: false, 179 | // runId: 25231746, 180 | // time: 1586506966000, 181 | // oj: 'LightOJ', 182 | // problemId: 26777, 183 | // sourceLength: 1096, 184 | // probNum: '1060', 185 | // status: 'Accepted' 186 | // } 187 | // ], 188 | // recordsTotal: 9999999, 189 | // recordsFiltered: 9999999, 190 | // draw: 1 191 | // } 192 | ``` 193 | 194 | ### contest_status(options) 195 | Returns submission status informations in contests, supports querying. Asynchronus function. 196 | 197 | ``` 198 | const options = { 199 | start: 0, // Start position from the problem-list, positive integer, default: 0 200 | length: 1, // Length of the output list, positive integer with maximum 20, default: 20 201 | un: 'rahathossain690', // Username of any user, default: '' (no specific user) 202 | res: 1, // Vjudge verdict expression, default: 0 (verdicts() function might help) 203 | num: '-', // Problem number in the contest (As A, B, C,...). Default: '-' (all problems) 204 | language: '', // Language of the submission, default: '' 205 | inContest: true, // Default: true 206 | contestId: 353950 // Contest-id can be found in contest links, required. 207 | } 208 | 209 | Vjudge.contest_status(options).then(result => console.log(result)).catch(err => console.error(error)) 210 | 211 | // result 212 | // { 213 | // data: [ 214 | // { 215 | // memory: 236, 216 | // access: 0, 217 | // statusType: 0, 218 | // runtime: 92, 219 | // language: 'GNU G++11 5.1.0', 220 | // statusCanonical: 'AC', 221 | // userName: 'rahathossain690', 222 | // userId: 227541, 223 | // languageCanonical: 'CPP', 224 | // contestId: 353950, 225 | // contestNum: 'G', 226 | // processing: false, 227 | // runId: 23858026, 228 | // time: 1580125710000, 229 | // problemId: 27808, 230 | // sourceLength: 969, 231 | // status: 'Accepted' 232 | // } 233 | // ], 234 | // recordsTotal: 9999999, 235 | // recordsFiltered: 9999999, 236 | // draw: 1 237 | // } 238 | ``` 239 | 240 | ### run_info(options) 241 | Returns run-time informations about a particular submission. Asynchronus function. 242 | 243 | ``` 244 | const options = { 245 | runId: 23858026 // Run-id can be found from status/contest-status, required. 246 | } 247 | 248 | Vjudge.run_info(options).then(result => console.log(result)).catch(err => console.error(error)) 249 | 250 | // result 251 | // { 252 | // memory: 236, 253 | // statusType: 0, 254 | // author: 'rahathossain690', 255 | // length: 969, 256 | // runtime: 92, 257 | // language: 'GNU G++11 5.1.0', 258 | // statusCanonical: 'AC', 259 | // authorId: 227541, 260 | // languageCanonical: 'CPP', 261 | // codeAccessInfo: 'This code is not shared', 262 | // contestId: 353950, 263 | // submitTime: 1580125710000, 264 | // isOpen: 0, 265 | // contestNum: 'G', 266 | // processing: false, 267 | // runId: 23858026, 268 | // oj: 'CodeForces', 269 | // remoteRunId: '69611972', 270 | // probNum: '159A', 271 | // status: 'Accepted' 272 | // } 273 | ``` 274 | 275 | ## Contributing 276 | Any kind of Contribution is highly welcomed. 277 | 278 | To contribute: Create an issue > Fork > Create own branch > Commit changes > Push the branch > Create pull request 279 | 280 | ## Todo 281 | 1. Contest time ranklist. 282 | 283 | This project is inspired from [vlawer](https://github.com/hoenchioma/vlawyer). 284 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | 3 | class Vjudge{ 4 | constructor(){ 5 | } 6 | 7 | static verdicts(){ 8 | return { 9 | "All": 0, 10 | "Accepted": 1, 11 | "Presentation Error": 2, 12 | "Wrong Answer": 3, 13 | "Time Limit Exceed": 4, 14 | "Memory Limit Exceed": 5, 15 | "Output Limit Exceed": 6, 16 | "Runtime Error": 7, 17 | "Compile Error": 8, 18 | "Unknown Error": 9, 19 | "Submit Error": 10, 20 | "Queuing && Judging": 11 21 | } 22 | } 23 | 24 | static async remote_ojs(){ 25 | try{ 26 | let response = await axios.get('https://vjudge.net/util/remoteOJs'); 27 | return response.data; 28 | } catch(err){ 29 | throw new Error(err); 30 | } 31 | } 32 | 33 | static async solve_count(data){ 34 | try{ 35 | data = this.validate_solve_count(data); 36 | let response = await axios.get('https://vjudge.net/user/solveDetail/' + data.un); 37 | return response.data; 38 | } catch(err){ 39 | throw new Error(err); 40 | } 41 | } 42 | 43 | static async run_info(data){ 44 | try{ 45 | data = this.validate_run_info(data); 46 | let response = await axios.get('https://vjudge.net/solution/data/' + data.runId); 47 | return response.data; 48 | } catch(err){ 49 | throw new Error(err); 50 | } 51 | } 52 | 53 | static async problems(data){ 54 | try{ 55 | data = this.validate_problems(data); 56 | let response = await axios.get('https://vjudge.net/problem/data?draw=1&start=' + data.start + '&length=' + data.length + '&sortDir= '+ data.sortDir +'&sortCol=' + data.sortCol + '&OJId=' + data.OJId + '&probNum='+data.probNum+'&title='+data.title+'&source='+data.source+'&category=' + data.category); 57 | return response.data; 58 | } catch(err){ 59 | throw new Error(err); 60 | } 61 | } 62 | static async contest_status(data){ 63 | try{ 64 | data = this.validate_contest_status(data); 65 | let response = await axios.get('https://vjudge.net/status/data?draw=1&start='+data.start+'&length='+data.length+'&un='+data.un+'&num='+data.num+'&res='+data.res+'&language='+data.language+'&inContest='+data.inContest+'&contestId='+data.contestId); 66 | return response.data; 67 | } catch(err){ 68 | throw new Error(err); 69 | } 70 | } 71 | static async status(data){ 72 | try{ 73 | data = this.validate_status(data); 74 | let response = await axios.get('https://vjudge.net/status/data/?draw=1&start='+data.start+'&length='+data.length+'&un='+data.un+'&OJId='+data.OJId+'&probNum='+data.probNum+'&res='+data.res+'&language='+data.language+'&onlyFollowee='+data.onlyFolowee); 75 | return response.data; 76 | } catch(err){ 77 | throw new Error(err); 78 | } 79 | } 80 | 81 | static validate_solve_count(data){ 82 | try{ 83 | if(data == null) data = {}; 84 | if(typeof(data.un) == 'string' && data.un.length >= 0) return data; 85 | else throw new Error(); 86 | } catch(err){ 87 | throw new Error('un is required and should be a non-empty string'); 88 | } 89 | } 90 | 91 | static validate_run_info(data){ 92 | try{ 93 | if(data == null) data = {}; 94 | if(typeof(data.runId) == 'number') return data; 95 | else throw new Error(); 96 | } catch(err){ 97 | throw new Error('runId is required and should be a number'); 98 | } 99 | } 100 | 101 | static validate_problems(data){ 102 | try{ 103 | if(data == null) data = {}; 104 | 105 | let {start, length, sortDir, sortCol, OJId, probNum, title, source, category} = data, new_data = {}; 106 | 107 | if(typeof(start) == 'number' && start >= 0 && Number.isInteger(start)) new_data.start = start; 108 | else if(start == null) new_data.start = 0; 109 | else throw new Error('start should be a positive number'); 110 | 111 | if(typeof(length) == 'number' && length <= 100 && length >= 0 && Number.isInteger(length)) new_data.length = length; 112 | else if(length == null) new_data.length = 20; 113 | else throw new Error('length should be an integer between 1 and 100'); 114 | 115 | if(sortDir == 'desc' || sortDir == 'asc') new_data.sortDir = sortDir; 116 | else if(sortDir == null) new_data.sortDir = 'desc'; 117 | else throw new Error('sortDir should be either desc or asc') 118 | 119 | if(typeof(sortCol) == 'number') new_data.sortCol = sortCol; 120 | else new_data.sortCol = 5; 121 | 122 | if(typeof(OJId) == 'string') new_data.OJId = OJId; 123 | else if(OJId == null) new_data.OJId = 'All'; 124 | else throw new Error('OJId should be string'); 125 | 126 | if(typeof(probNum) == 'string') new_data.probNum = probNum; 127 | else if(probNum == null) new_data.probNum = ''; 128 | else throw new Error('probNum should be string') 129 | 130 | if(typeof(title) == 'string') new_data.title = title; 131 | else if(title == null) new_data.title = ''; 132 | else throw new Error('title should be string'); 133 | 134 | if(typeof(source) == 'string') new_data.source = source; 135 | else if(source == null) new_data.source = ''; 136 | else throw new Error('source should be string'); 137 | 138 | if(typeof(category) == 'string') new_data.source = source; 139 | else if(category == null) new_data.source = ''; 140 | else throw new Error('category should be string'); 141 | 142 | return new_data; 143 | 144 | }catch(err){ 145 | throw new Error(err); 146 | } 147 | } 148 | 149 | static validate_contest_status(data){ 150 | try{ 151 | if(data == null) data = {}; 152 | let {start, length, un, num, res, language, inContest, contestId} = data, new_data = {}; 153 | 154 | if(typeof(start) == 'number' && start >= 0 && Number.isInteger(start)) new_data.start = start; 155 | else if(start == null) new_data.start = 0; 156 | else throw new Error('start should be a positive integer'); 157 | 158 | if(typeof(length) == 'number' && length <= 20 && length >= 0 && Number.isInteger(length)) new_data.length = length; 159 | else if(length == null) new_data.length = 20; 160 | else throw new Error('length should be an integer between 1 and 20'); 161 | 162 | if(typeof(un) == 'string') new_data.un = un; 163 | else if(un == null) new_data.un = ''; 164 | else throw new Error('un should be string'); 165 | 166 | if(typeof(num) == 'string') new_data.num = num; 167 | else if(num == null) new_data.num = '-'; 168 | else throw new Error('num should be string'); 169 | 170 | if(typeof(res) == 'number' && res >= 0 && Number.isInteger(res) && res <= 11) new_data.res = res; 171 | else if(res == null) new_data.res = 0; 172 | else throw new Error('res should be a positive integer between 0 and 11'); 173 | 174 | if(typeof(language) == 'string') new_data.language = language; 175 | else if(language == null) new_data.language = 'All'; 176 | else throw new Error('language should be string'); 177 | 178 | if(typeof(inContest) == 'boolean') new_data.inContest = inContest; 179 | else if(inContest == null) new_data.inContest = true; 180 | else throw new Error('inContest should be boolean'); 181 | 182 | if(typeof(contestId) == 'number') new_data.contestId = contestId; 183 | else throw new Error('contestId is required and should be string') 184 | 185 | return new_data; 186 | 187 | } catch(err){ 188 | throw new Error(err); 189 | } 190 | } 191 | 192 | static validate_status(data){ 193 | try{ 194 | if(data == null) data = {}; 195 | let {start, length, un, res, language, OJId, probNum, onlyFolowee} = data, new_data = {}; 196 | 197 | if(typeof(start) == 'number' && start >= 0 && Number.isInteger(start)) new_data.start = start; 198 | else if(start == null) new_data.start = 0; 199 | else throw new Error('start should be a positive integer'); 200 | 201 | if(typeof(length) == 'number' && length <= 20 && length >= 0 && Number.isInteger(length)) new_data.length = length; 202 | else if(length == null) new_data.length = 20; 203 | else throw new Error('length should be an integer between 1 and 20'); 204 | 205 | if(typeof(un) == 'string') new_data.un = un; 206 | else if(un == null) new_data.un = ''; 207 | else throw new Error('un should be string'); 208 | 209 | if(typeof(res) == 'number' && res >= 0 && Number.isInteger(res) && res <= 11) new_data.res = res; 210 | else if(res == null) new_data.res = 0; 211 | else throw new Error('res should be a positive integer between 0 and 11'); 212 | 213 | if(typeof(language) == 'string') new_data.language = language; 214 | else if(language == null) new_data.language = ''; 215 | else throw new Error('language should be string'); 216 | 217 | if(typeof(OJId) == 'string') new_data.OJId = OJId; 218 | else if(OJId == null) new_data.OJId = 'All'; 219 | else throw new Error('OJId should be string'); 220 | 221 | if(typeof(probNum) == 'string') new_data.probNum = probNum; 222 | else if(probNum == null) new_data.probNum = ''; 223 | else throw new Error('probNum should be string'); 224 | 225 | if(typeof(onlyFolowee) == 'boolean') new_data.onlyFolowee = onlyFolowee; 226 | else if(onlyFolowee == null) new_data.onlyFolowee = false; 227 | else throw new Error('onlyFolowee should be boolean'); 228 | 229 | return new_data; 230 | 231 | }catch(err){ 232 | throw new Error(err) 233 | } 234 | } 235 | } 236 | 237 | module.exports = Vjudge; 238 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vjudge-api", 3 | "version": "1.0.0", 4 | "description": "Unofficial Vjudge api library", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "jest --detectOpenHandles", 8 | "start": "node index" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/rahathossain690/vjudge-node.git" 13 | }, 14 | "keywords": [ 15 | "Vjudge", 16 | "api", 17 | "competetive", 18 | "programming", 19 | "vjudge-node", 20 | "ACM" 21 | ], 22 | "author": "Rahat Hossain", 23 | "license": "ISC", 24 | "bugs": { 25 | "url": "https://github.com/rahathossain690/vjudge-node/issues" 26 | }, 27 | "homepage": "https://github.com/rahathossain690/vjudge-node#readme", 28 | "dependencies": { 29 | "axios": "^0.20.0" 30 | }, 31 | "devDependencies": { 32 | "jest": "^26.5.3" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/vjudge_api.test.js: -------------------------------------------------------------------------------- 1 | const vjudge_api = require('../index') 2 | 3 | 4 | describe('solve_count', ()=>{ 5 | test('with empty peramiter', () => { 6 | expect( vjudge_api.solve_count() ).rejects.toThrow('un is required and should be a non-empty string'); 7 | }) 8 | 9 | test('with wrong peramiter', () => { 10 | expect( vjudge_api.solve_count({bad: "new bad"}) ).rejects.toThrow('un is required and should be a non-empty string'); 11 | }) 12 | 13 | test('with wrong username', () => { 14 | expect( vjudge_api.solve_count({un: "rahathon680"}) ).rejects.toThrow('Request failed with status code 500'); 15 | }) 16 | 17 | test('with correct username', () => { 18 | const oj_data_rahathossain690 = { 19 | "acRecords": { 20 | "AtCoder": [ 21 | "abc084_d", 22 | "arc099_a", 23 | "soundhound2018_summer_qual_b" 24 | ], 25 | "CodeChef": [ 26 | "PRGIFT", 27 | "DRAGNXOR" 28 | ], 29 | "CodeForces": [ 30 | "58A", 31 | "21C", 32 | "66B", 33 | "66D", 34 | "80A", 35 | "47A", 36 | "47B", 37 | "68A", 38 | "68B", 39 | "11A", 40 | "50B", 41 | "131C", 42 | "137A", 43 | "159A", 44 | "200B", 45 | "84B", 46 | "289A", 47 | "315A", 48 | "376A", 49 | "379A", 50 | "471A", 51 | "293A", 52 | "147A", 53 | "509A", 54 | "575D", 55 | "805A", 56 | "862A", 57 | "926A", 58 | "962C", 59 | "1006B", 60 | "1182B" 61 | ], 62 | "EOlymp": [ 63 | "1013" 64 | ], 65 | "Gym": [ 66 | "100796F", 67 | "101291A", 68 | "101291F", 69 | "101291K", 70 | "101291M", 71 | "101350B", 72 | "101350H", 73 | "101853D", 74 | "101853F", 75 | "101853H", 76 | "101853I", 77 | "101853J", 78 | "102267B", 79 | "102419A", 80 | "102419C", 81 | "102419E", 82 | "102419L" 83 | ], 84 | "HackerRank": [ 85 | "pangrams", 86 | "fair-cake-cutting" 87 | ], 88 | "Kattis": [ 89 | "zamka", 90 | "abc", 91 | "quickestimate" 92 | ], 93 | "LightOJ": [ 94 | "1003", 95 | "1008", 96 | "1010", 97 | "1012", 98 | "1018", 99 | "1020", 100 | "1021", 101 | "1022", 102 | "1026", 103 | "1032", 104 | "1037", 105 | "1040", 106 | "1042", 107 | "1307", 108 | "1173", 109 | "1049", 110 | "1045", 111 | "1052", 112 | "1057", 113 | "1059", 114 | "1060", 115 | "1062", 116 | "1063", 117 | "1065", 118 | "1068", 119 | "1070", 120 | "1072", 121 | "1076", 122 | "1077", 123 | "1083", 124 | "1085", 125 | "1088", 126 | "1089", 127 | "1094", 128 | "1096", 129 | "1100", 130 | "1107", 131 | "1109", 132 | "1111", 133 | "1116", 134 | "1122", 135 | "1125", 136 | "1129", 137 | "1134", 138 | "1135", 139 | "1136", 140 | "1141", 141 | "1146", 142 | "1164", 143 | "1166", 144 | "1170", 145 | "1174", 146 | "1190", 147 | "1201", 148 | "1202", 149 | "1203", 150 | "1210", 151 | "1211", 152 | "1214", 153 | "1216", 154 | "1239", 155 | "1248", 156 | "1257", 157 | "1258", 158 | "1276", 159 | "1285", 160 | "1291", 161 | "1292", 162 | "1298", 163 | "1300", 164 | "1301", 165 | "1305", 166 | "1311", 167 | "1319", 168 | "1322", 169 | "1328", 170 | "1331", 171 | "1333", 172 | "1382", 173 | "1389", 174 | "1414", 175 | "1417", 176 | "1425" 177 | ], 178 | "SPOJ": [ 179 | "GERGOVIA", 180 | "GEOPROB", 181 | "FANCY", 182 | "GOALFR", 183 | "SNGINT", 184 | "AGPC01D", 185 | "AGPC01F", 186 | "VEXPROF" 187 | ], 188 | "URAL": [ 189 | "1000", 190 | "1225", 191 | "2045" 192 | ], 193 | "UVA": [ 194 | "11995", 195 | "11850", 196 | "10242", 197 | "839", 198 | "11121", 199 | "10791", 200 | "10589", 201 | "10026", 202 | "10954", 203 | "11401", 204 | "10079", 205 | "11876", 206 | "12060", 207 | "11727", 208 | "10432", 209 | "10324", 210 | "10286", 211 | "11244", 212 | "11246", 213 | "737", 214 | "12852", 215 | "12853", 216 | "1709", 217 | "1730" 218 | ], 219 | "UVALive": [ 220 | "3473", 221 | "6918" 222 | ] 223 | }, 224 | "failRecords": { 225 | "AtCoder": [ 226 | "arc100_a" 227 | ], 228 | "CodeForces": [ 229 | "429D", 230 | "862B", 231 | "1187C" 232 | ], 233 | "Gym": [ 234 | "101291B", 235 | "101291G", 236 | "102367B" 237 | ], 238 | "HackerRank": [ 239 | "aorb", 240 | "short-palindrome" 241 | ], 242 | "LightOJ": [ 243 | "1058", 244 | "1071", 245 | "1079", 246 | "1149", 247 | "1185", 248 | "1233", 249 | "1256", 250 | "1357", 251 | "1379" 252 | ], 253 | "POJ": [ 254 | "2689" 255 | ], 256 | "SPOJ": [ 257 | "IPL1", 258 | "HG", 259 | "POWPOW2", 260 | "MSCHED", 261 | "ADAGCD" 262 | ], 263 | "URAL": [ 264 | "1750", 265 | "1183" 266 | ], 267 | "UVA": [ 268 | "573", 269 | "11345", 270 | "10819", 271 | "11436", 272 | "11247", 273 | "11055", 274 | "11264", 275 | "11491" 276 | ], 277 | "UVALive": [ 278 | "4739" 279 | ] 280 | } 281 | } // data of 17 oct, 2020 282 | expect( vjudge_api.solve_count({un: "rahathossain690"}) ).resolves.toStrictEqual(oj_data_rahathossain690); 283 | }) 284 | }) 285 | 286 | describe('remote_ojs', ()=>{ 287 | 288 | test('remote_ojs', ()=>{ 289 | const last_oj_data = { 290 | "SGU": { 291 | "name": "SGU", 292 | "languages": { 293 | 294 | } 295 | }, 296 | "FZU": { 297 | "name": "FZU", 298 | "languages": { 299 | "0": "GNU C++", 300 | "1": "GNU C", 301 | "2": "Pascal", 302 | "3": "Java", 303 | "4": "Visual C++", 304 | "5": "Visual C" 305 | } 306 | }, 307 | "UVA": { 308 | "name": "UVA", 309 | "languages": { 310 | "1": "ANSI C 5.3.0", 311 | "2": "JAVA 1.8.0", 312 | "3": "C++ 5.3.0", 313 | "4": "PASCAL 3.0.0", 314 | "5": "C++11 5.3.0", 315 | "6": "PYTH3 3.5.1" 316 | } 317 | }, 318 | "HRBUST": { 319 | "name": "HRBUST", 320 | "languages": { 321 | "1": "GCC", 322 | "2": "G++", 323 | "3": "JAVA", 324 | "4": "PHP", 325 | "5": "Python2", 326 | "7": "Haskell" 327 | } 328 | }, 329 | "SCU": { 330 | "name": "SCU", 331 | "languages": { 332 | "C++": "C++", 333 | "C": "C", 334 | "Java": "Java", 335 | "Pascal": "Pascal" 336 | } 337 | }, 338 | "51Nod": { 339 | "name": "51Nod", 340 | "languages": { 341 | "1": "C", 342 | "2": "C 11", 343 | "11": "C++", 344 | "12": "C++ 11", 345 | "21": "C#", 346 | "31": "Java", 347 | "41": "Python2", 348 | "42": "Python3", 349 | "45": "PyPy2", 350 | "46": "PyPy3", 351 | "51": "Ruby", 352 | "61": "Php", 353 | "71": "Haskell", 354 | "81": "Scala", 355 | "91": "Javascript", 356 | "101": "Go", 357 | "111": "Visual C++", 358 | "121": "Objective C", 359 | "131": "Pascal" 360 | } 361 | }, 362 | "TopCoder": { 363 | "name": "TopCoder", 364 | "languages": { 365 | "1": "Java", 366 | "3": "C++", 367 | "4": "C#", 368 | "5": "VB", 369 | "6": "Python" 370 | } 371 | }, 372 | "Z_trening": { 373 | "name": "Z_trening", 374 | "languages": { 375 | "1": "Pascal fpc 3.0.0", 376 | "2": "C gcc 6.3.1", 377 | "3": "C99 gcc 6.3.1", 378 | "4": "C++98 gcc 6.3.1", 379 | "5": "C++11 gcc 6.3.1", 380 | "6": "C++14 gcc 6.3.1", 381 | "7": "Java gcc-gcj 6.3.1" 382 | } 383 | }, 384 | "HUST": { 385 | "name": "HUST", 386 | "languages": { 387 | "0": "C", 388 | "1": "C++", 389 | "2": "Pascal", 390 | "3": "Java" 391 | } 392 | }, 393 | "EOlymp": { 394 | "name": "EOlymp", 395 | "languages": { 396 | "csharp": "C#", 397 | "gpp": "C++", 398 | "go": "Go", 399 | "haskell": "Haskell", 400 | "java": "Java", 401 | "js": "JavaScript", 402 | "kotlin": "Kotlin", 403 | "fpc": "Pascal", 404 | "php": "PHP", 405 | "python": "Python", 406 | "ruby": "Ruby", 407 | "rust": "Rust" 408 | } 409 | }, 410 | "HackerRank": { 411 | "name": "HackerRank", 412 | "languages": { 413 | "c": "c", 414 | "cpp": "cpp", 415 | "java": "java", 416 | "csharp": "csharp", 417 | "php": "php", 418 | "ruby": "ruby", 419 | "python": "python", 420 | "perl": "perl", 421 | "haskell": "haskell", 422 | "clojure": "clojure", 423 | "scala": "scala", 424 | "lua": "lua", 425 | "go": "go", 426 | "javascript": "javascript", 427 | "erlang": "erlang", 428 | "d": "d", 429 | "ocaml": "ocaml", 430 | "pascal": "pascal", 431 | "python3": "python3", 432 | "groovy": "groovy", 433 | "objectivec": "objectivec", 434 | "fsharp": "fsharp", 435 | "visualbasic": "visualbasic", 436 | "lolcode": "lolcode", 437 | "smalltalk": "smalltalk", 438 | "tcl": "tcl", 439 | "whitespace": "whitespace", 440 | "sbcl": "sbcl", 441 | "java8": "java8", 442 | "octave": "octave", 443 | "racket": "racket", 444 | "rust": "rust", 445 | "bash": "bash", 446 | "r": "r", 447 | "swift": "swift", 448 | "fortran": "fortran", 449 | "cpp14": "cpp14", 450 | "coffeescript": "coffeescript", 451 | "ada": "ada", 452 | "pypy": "pypy", 453 | "pypy3": "pypy3", 454 | "julia": "julia", 455 | "elixir": "elixir" 456 | } 457 | }, 458 | "LibreOJ": { 459 | "name": "LibreOJ", 460 | "languages": { 461 | "cpp": "C++ GCC 8.2.0", 462 | "cpp11": "C++ 11 GCC 8.2.0", 463 | "cpp17": "C++ 17 GCC 8.2.0", 464 | "cpp-noilinux": "C++ (NOI) GCC 4.8.4 (NOILinux 1.4.1)", 465 | "cpp11-noilinux": "C++ 11 (NOI) GCC 4.8.4 (NOILinux 1.4.1)", 466 | "cpp11-clang": "C++ 11 (Clang) Clang 7.0.1", 467 | "cpp17-clang": "C++ 17 (Clang) Clang 7.0.1", 468 | "c": "C Clang 7.0.1", 469 | "c-noilinux": "C (NOI) GCC 4.8.4 (NOILinux 1.4.1)", 470 | "csharp": "C# Mono 5.16.0.220", 471 | "java": "Java OpenJDK 10.0.2", 472 | "pascal": "Pascal Free Pascal 3.0.4", 473 | "python2": "Python 2 PyPy 6.0.0 (Python 2.7.13)", 474 | "python3": "Python 3 PyPy 6.0.0 (Python 3.5.3)", 475 | "nodejs": "Node.js 10.14.0", 476 | "ruby": "Ruby 2.5.1", 477 | "haskell": "Haskell GHC 8.6.2" 478 | } 479 | }, 480 | "OpenJ_Bailian": { 481 | "name": "OpenJ_Bailian", 482 | "languages": { 483 | "G++": "G++(5.3)", 484 | "GCC": "GCC(5.3)", 485 | "Java": "Java(OpenJDK9)", 486 | "Pascal": "Pascal(FreePascal)", 487 | "Python2": "Python2(2.7)", 488 | "Python3": "Python3(3.5)", 489 | "C#": "C#(mono4.2)", 490 | "Racket": "Racket(6.5)" 491 | } 492 | }, 493 | "HDU": { 494 | "name": "HDU", 495 | "languages": { 496 | "0": "G++", 497 | "1": "GCC", 498 | "2": "C++", 499 | "3": "C", 500 | "4": "Pascal", 501 | "5": "Java", 502 | "6": "C#" 503 | } 504 | }, 505 | "UESTC_old": { 506 | "name": "UESTC_old", 507 | "languages": { 508 | 509 | } 510 | }, 511 | "AtCoder": { 512 | "name": "AtCoder", 513 | "languages": { 514 | 515 | } 516 | }, 517 | "HYSBZ": { 518 | "name": "HYSBZ", 519 | "languages": { 520 | "0": "C", 521 | "1": "C++", 522 | "2": "Pascal", 523 | "3": "Java", 524 | "6": "Python" 525 | } 526 | }, 527 | "Gym": { 528 | "name": "Gym", 529 | "languages": { 530 | 531 | } 532 | }, 533 | "Aizu": { 534 | "name": "Aizu", 535 | "languages": { 536 | "C": "C", 537 | "C++": "C++", 538 | "JAVA": "JAVA", 539 | "C++11": "C++11", 540 | "C++14": "C++14", 541 | "C#": "C#", 542 | "D": "D", 543 | "Ruby": "Ruby", 544 | "Python": "Python", 545 | "Python3": "Python3", 546 | "PHP": "PHP", 547 | "JavaScript": "JavaScript", 548 | "Scala": "Scala", 549 | "Haskell": "Haskell", 550 | "OCaml": "OCaml", 551 | "Rust": "Rust", 552 | "Go": "Go", 553 | "Kotlin": "Kotlin" 554 | } 555 | }, 556 | "SPOJ": { 557 | "name": "SPOJ", 558 | "languages": { 559 | 560 | } 561 | }, 562 | "CodeForces": { 563 | "name": "CodeForces", 564 | "languages": { 565 | 566 | } 567 | }, 568 | "ACdream": { 569 | "name": "ACdream", 570 | "languages": { 571 | "1": "C", 572 | "2": "C++", 573 | "3": "Java" 574 | } 575 | }, 576 | "CSU": { 577 | "name": "CSU", 578 | "languages": { 579 | "0": "C", 580 | "1": "C++", 581 | "3": "Java", 582 | "6": "Python" 583 | } 584 | }, 585 | "CodeChef": { 586 | "name": "CodeChef", 587 | "languages": { 588 | 589 | } 590 | }, 591 | "UVALive": { 592 | "name": "UVALive", 593 | "languages": { 594 | "1": "ANSI C 5.3.0", 595 | "2": "JAVA 1.8.0", 596 | "3": "C++ 5.3.0", 597 | "4": "PASCAL 3.0.0", 598 | "5": "C++11 5.3.0", 599 | "6": "PYTH3 3.5.1" 600 | } 601 | }, 602 | "OpenJ_POJ": { 603 | "name": "OpenJ_POJ", 604 | "languages": { 605 | "G++": "G++(5.3)", 606 | "GCC": "GCC(5.3)", 607 | "Java": "Java(OpenJDK9)", 608 | "Pascal": "Pascal(FreePascal)" 609 | } 610 | }, 611 | "Kattis": { 612 | "name": "Kattis", 613 | "languages": { 614 | "C": "C", 615 | "C#": "C#", 616 | "C++": "C++", 617 | "COBOL": "COBOL", 618 | "Common Lisp": "Common Lisp", 619 | "F#": "F#", 620 | "Go": "Go", 621 | "Haskell": "Haskell", 622 | "Java": "Java", 623 | "JavaScript (Node.js)": "JavaScript (Node.js)", 624 | "JavaScript (SpiderMonkey)": "JavaScript (SpiderMonkey)", 625 | "Kotlin": "Kotlin", 626 | "Objective-C": "Objective-C", 627 | "OCaml": "OCaml", 628 | "Pascal": "Pascal", 629 | "PHP": "PHP", 630 | "Prolog": "Prolog", 631 | "Python 2": "Python 2", 632 | "Python 3": "Python 3", 633 | "Ruby": "Ruby", 634 | "Rust": "Rust" 635 | } 636 | }, 637 | "POJ": { 638 | "name": "POJ", 639 | "languages": { 640 | "0": "G++", 641 | "1": "GCC", 642 | "2": "Java", 643 | "3": "Pascal", 644 | "4": "C++", 645 | "5": "C", 646 | "6": "Fortran" 647 | } 648 | }, 649 | "HihoCoder": { 650 | "name": "HihoCoder", 651 | "languages": { 652 | "GCC": "GCC", 653 | "G++": "G++", 654 | "C#": "C#", 655 | "Java": "Java", 656 | "Python2": "Python2" 657 | } 658 | }, 659 | "URAL": { 660 | "name": "URAL", 661 | "languages": { 662 | 663 | } 664 | }, 665 | "HIT": { 666 | "name": "HIT", 667 | "languages": { 668 | "C++": "C++", 669 | "C89": "C89", 670 | "Java": "Java", 671 | "Pascal": "Pascal" 672 | } 673 | }, 674 | "LightOJ": { 675 | "name": "LightOJ", 676 | "languages": { 677 | "C": "C", 678 | "C++": "C++", 679 | "JAVA": "JAVA", 680 | "PASCAL": "PASCAL" 681 | } 682 | }, 683 | "ZOJ": { 684 | "name": "ZOJ", 685 | "languages": { 686 | "GCC": "C (gcc 4.7.2)", 687 | "GXX": "C++ (g++ 6.4.0)", 688 | "JAVAC": "Java (java 1.8.0)", 689 | "PYTHON2": "Python (python 2.7.12)", 690 | "PYTHON3": "Python (python 3.6.5)" 691 | } 692 | }, 693 | "Minieye": { 694 | "name": "Minieye", 695 | "languages": { 696 | "C": "GCC 5.4", 697 | "C++": "G++ 5.4", 698 | "Java": "OpenJDK 1.8", 699 | "Python3": "Python 3.5", 700 | "Golang": "Go 1.11" 701 | } 702 | }, 703 | "NBUT": { 704 | "name": "NBUT", 705 | "languages": { 706 | "1": "GCC", 707 | "2": "G++", 708 | "4": "FPC" 709 | } 710 | }, 711 | "EIJudge": { 712 | "name": "EIJudge", 713 | "languages": { 714 | "Free Pascal": "Free Pascal 1.8.2", 715 | "GNU C": "GNU C 3.3.3", 716 | "GNU C++": "GNU C++ 3.3.3", 717 | "Haskell": "Haskell GC 6.8.2", 718 | "Java": "java 1.5.0", 719 | "Kylix": "Kylix 14.5", 720 | "Lua": "Lua 5.1.3", 721 | "OCaml": "Objective Caml 3.10.2", 722 | "Perl": "Perl 5.8.5", 723 | "Python": "Python 2.1.3", 724 | "Ruby": "Ruby 1.8.6", 725 | "Scheme": "mzScheme 301 Swindle" 726 | } 727 | }, 728 | "计蒜客": { 729 | "name": "计蒜客", 730 | "languages": { 731 | "c": "C", 732 | "c_noi": "C (NOI)", 733 | "c++": "C++11", 734 | "c++14": "C++14", 735 | "c++_noi": "C++ (NOI)", 736 | "java": "Java", 737 | "python": "Python 2.7", 738 | "python3": "Python 3.5", 739 | "ruby": "Ruby", 740 | "octave": "Octave", 741 | "pascal": "Pascal", 742 | "go": "Go" 743 | } 744 | }, 745 | "UESTC": { 746 | "name": "UESTC", 747 | "languages": { 748 | "1": "C", 749 | "2": "C++", 750 | "3": "Java" 751 | } 752 | } 753 | }; // data of 17 oct, 2020 754 | expect(vjudge_api.remote_ojs()).resolves.toStrictEqual(last_oj_data); 755 | }) 756 | 757 | }) 758 | 759 | describe('run_info', ()=>{ 760 | 761 | test('with empty peramiter', ()=>{ 762 | expect(vjudge_api.run_info()).rejects.toThrow('runId is required and should be a number'); 763 | }) 764 | 765 | test('with wrong type', ()=>{ 766 | expect(vjudge_api.run_info({runId: "hello"})).rejects.toThrow('runId is required and should be a number'); 767 | }) 768 | 769 | test('with wrong peramiter', ()=>{ 770 | expect(vjudge_api.run_info({runId: "hello"})).rejects.toThrow('runId is required and should be a number'); 771 | }) 772 | 773 | test('with correct peramiter', ()=>{ 774 | const data_for_27812108 = { 775 | "statusType": 1, 776 | "author": "Averenkov", 777 | "length": 4867, 778 | "language": "C++17(gcc 9.1)", 779 | "statusCanonical": "WA", 780 | "authorId": 365174, 781 | "languageCanonical": "CPP", 782 | "codeAccessInfo": "This code is not shared", 783 | "contestId": 388688, 784 | "submitTime": 1602881296000, 785 | "isOpen": 0, 786 | "contestNum": "D", 787 | "processing": false, 788 | "runId": 27812108, 789 | "oj": "CodeChef", 790 | "remoteRunId": "38969069", 791 | "probNum": "CLUNQUE", 792 | "status": "Wrong Answer" 793 | } 794 | expect(vjudge_api.run_info({runId: 27812108})).resolves.toStrictEqual(data_for_27812108); 795 | }) 796 | 797 | }) 798 | 799 | 800 | describe('problems', ()=>{ 801 | 802 | test('no peramiter but valid', ()=>{ 803 | expect( vjudge_api.problems() ).resolves; 804 | }) 805 | 806 | test('different start type', ()=>{ 807 | expect( vjudge_api.problems({start : "haha"}) ).rejects.toThrow('start should be a positive number'); 808 | }) 809 | 810 | test('start to be negetive', ()=>{ 811 | expect( vjudge_api.problems({start : -10}) ).rejects.toThrow('start should be a positive number'); 812 | }) 813 | 814 | test('start to be floating point', ()=>{ 815 | expect( vjudge_api.problems({start : 1.2}) ).rejects.toThrow('start should be a positive number'); 816 | }) 817 | 818 | test('different length type', ()=>{ 819 | expect( vjudge_api.problems({length : "haha"}) ).rejects.toThrow('length should be an integer between 1 and 100'); 820 | }) 821 | 822 | test('length to be negetive', ()=>{ 823 | expect( vjudge_api.problems({length : -10}) ).rejects.toThrow('length should be an integer between 1 and 100'); 824 | }) 825 | 826 | test('length to be floating point', ()=>{ 827 | expect( vjudge_api.problems({length : 1.2}) ).rejects.toThrow('length should be an integer between 1 and 100'); 828 | }) 829 | 830 | test('length to be more than 100', ()=>{ 831 | expect( vjudge_api.problems({length : 1010}) ).rejects.toThrow('length should be an integer between 1 and 100'); 832 | }) 833 | 834 | test('sortDir to be other thing', () => { 835 | expect( vjudge_api.problems({sortDir: "bleh"}) ).rejects.toThrow('sortDir should be either desc or asc'); 836 | }) 837 | 838 | test('OJId to be other thing', () => { 839 | expect( vjudge_api.problems({OJId: 69}) ).rejects.toThrow('OJId should be string') 840 | }) 841 | 842 | test('probNum to be other thing', () => { 843 | expect( vjudge_api.problems({probNum: 69}) ).rejects.toThrow('probNum should be string') 844 | }) 845 | 846 | test('title to be other thing', () => { 847 | expect( vjudge_api.problems({title: 69}) ).rejects.toThrow('title should be string') 848 | }) 849 | 850 | test('source to be other thing', () => { 851 | expect( vjudge_api.problems({source: 69}) ).rejects.toThrow('source should be string') 852 | }) 853 | 854 | test('category to be other thing', () => { 855 | expect( vjudge_api.problems({category: 69}) ).rejects.toThrow('category should be string') 856 | }) 857 | 858 | }) 859 | 860 | describe('contest_status', ()=>{ 861 | 862 | test('no peremiter', () => { 863 | expect( vjudge_api.contest_status() ).rejects.toThrow('contestId is required and should be string'); 864 | }) 865 | 866 | test('start with different value', ()=>{ 867 | expect( vjudge_api.contest_status({start: "haha"}) ).rejects.toThrow("start should be a positive integer"); 868 | }); 869 | 870 | test('length with different value', () => { 871 | expect( vjudge_api.contest_status({length: "haha"}) ).rejects.toThrow("length should be an integer between 1 and 20"); 872 | }) 873 | 874 | test('length with value more than 20', () => { 875 | expect( vjudge_api.contest_status({length: 100}) ).rejects.toThrow("length should be an integer between 1 and 20"); 876 | }) 877 | 878 | test('un with different value', ()=>{ 879 | expect( vjudge_api.contest_status({un: 100})).rejects.toThrow("un should be string"); 880 | }) 881 | 882 | test('num with different value', ()=>{ 883 | expect( vjudge_api.contest_status({num: 100})).rejects.toThrow("num should be string"); 884 | }) 885 | 886 | test('res with different value', ()=>{ 887 | expect( vjudge_api.contest_status({res: "haha"})).rejects.toThrow("res should be a positive integer between 0 and 11"); 888 | }) 889 | 890 | test('res with value more than 11', ()=>{ 891 | expect( vjudge_api.contest_status({res: 20})).rejects.toThrow("res should be a positive integer between 0 and 11"); 892 | }) 893 | 894 | test('language with different value', ()=>{ 895 | expect( vjudge_api.contest_status({language: 100})).rejects.toThrow("language should be string"); 896 | }) 897 | 898 | test('inContest with different value', ()=>{ 899 | expect( vjudge_api.contest_status({inContest: 100})).rejects.toThrow("inContest should be boolean"); 900 | }) 901 | 902 | test('contestId with different value', ()=>{ 903 | expect( vjudge_api.contest_status({contestId: "haha"})).rejects.toThrow("contestId is required and should be string"); 904 | }) 905 | 906 | }) 907 | 908 | describe('status', ()=>{ 909 | test('no peremiter', () => { 910 | expect( vjudge_api.status() ).resolves; 911 | }) 912 | 913 | test('start with different value', ()=>{ 914 | expect( vjudge_api.status({start: "haha"}) ).rejects.toThrow("start should be a positive integer"); 915 | }); 916 | 917 | test('length with different value', () => { 918 | expect( vjudge_api.status({length: "haha"}) ).rejects.toThrow("length should be an integer between 1 and 20"); 919 | }) 920 | 921 | test('length with value more than 20', () => { 922 | expect( vjudge_api.status({length: 100}) ).rejects.toThrow("length should be an integer between 1 and 20"); 923 | }) 924 | 925 | test('un with different value', ()=>{ 926 | expect( vjudge_api.status({un: 100})).rejects.toThrow("un should be string"); 927 | }) 928 | 929 | test('res with different value', ()=>{ 930 | expect( vjudge_api.status({res: "haha"})).rejects.toThrow("res should be a positive integer between 0 and 11"); 931 | }) 932 | 933 | test('res with value more than 11', ()=>{ 934 | expect( vjudge_api.status({res: 20})).rejects.toThrow("res should be a positive integer between 0 and 11"); 935 | }) 936 | 937 | test('language with different value', ()=>{ 938 | expect( vjudge_api.status({language: 100})).rejects.toThrow("language should be string"); 939 | }) 940 | 941 | test('onlyFolowee with different value', ()=>{ 942 | expect( vjudge_api.status({onlyFolowee: "haha"})).rejects.toThrow("onlyFolowee should be boolean"); 943 | }) 944 | }) 945 | 946 | describe("verditcs", () => { 947 | expect( vjudge_api.verdicts() ).toStrictEqual({ 948 | 'All': 0, 949 | 'Accepted': 1, 950 | 'Presentation Error': 2, 951 | 'Wrong Answer': 3, 952 | 'Time Limit Exceed': 4, 953 | 'Memory Limit Exceed': 5, 954 | 'Output Limit Exceed': 6, 955 | 'Runtime Error': 7, 956 | 'Compile Error': 8, 957 | 'Unknown Error': 9, 958 | 'Submit Error': 10, 959 | 'Queuing && Judging': 11 960 | }); 961 | }) --------------------------------------------------------------------------------