How to use test_desc method in wpt

Best JavaScript code snippet using wpt

RolesLib.test.js

Source:RolesLib.test.js Github

copy

Full Screen

1const RolesLibTest = artifacts.require("RolesLibTest")2 , truffleAssert = require('truffle-assertions')3 , { shouldThrow, solToNum, bytesDoSFactory} = require('../utils');4// Traditional Truffle test5contract("RolesLibTest", accounts => {6 let roles;7 let [acc] = accounts;8 const TEST_ROLE = 'test-role'9 , TEST_NAME = 'Test name'10 , TEST_DESC = 'Test description'11 , TEST_LOGO = 'TEST_logo.png'12 , zeroAddress = '0x0000000000000000000000000000000000000000';13 beforeEach(async () => {14 roles = await RolesLibTest.new();15 });16 describe('Unit tests', function () {17 describe('addRole', function () {18 it('should overflow after 255 roles', async function () {19 for (let i = 0; i < 255; i++ ) {20 await roles.addRole(`test${i}`);21 }22 await roles.addRole('error');23 const res = await roles.checkStoreRoleNames(0);24 assert.equal(res, 'error');25 assert.notEqual(res, 'test0');26 });27 it('should add role', async function () {28 await roles.addRole(TEST_ROLE);29 const count = await roles.getStoreCount();30 const role = await roles.checkStoreRoleNames(1);31 assert.equal(count, 1);32 assert.equal(role, TEST_ROLE);33 });34 it('should revert if adding existing role', async function () {35 await roles.addRole(TEST_ROLE);36 const count = await roles.getStoreCount();37 const role = await roles.checkStoreRoleNames(1);38 assert.equal(count, 1);39 assert.equal(role, TEST_ROLE);40 await truffleAssert.reverts(41 roles.addRole(TEST_ROLE),42 null43 );44 });45 it('should revert if adding empty string', async function () {46 await truffleAssert.reverts(47 roles.addRole(''),48 null49 )50 });51 });52 describe('addSubject', function () {53 it('should add subject', async function () {54 await roles.addRole(TEST_ROLE);55 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);56 const count = await roles.getRoleCount(TEST_ROLE);57 const id = await roles.getRoleAccToNum(TEST_ROLE, acc);58 const _acc = await roles.getRoleNumToAcc(TEST_ROLE, count);59 const subject = await roles.getRoleSubjects(TEST_ROLE, acc);60 assert.equal(count, 1);61 assert.equal(solToNum(id), solToNum(count));62 assert.equal(_acc, acc);63 assert.equal(subject.accessLevel, 1);64 assert.equal(subject.name, TEST_NAME);65 assert.equal(subject.description, TEST_DESC);66 assert.equal(subject.logo, TEST_LOGO);67 });68 it('should revert add subject to not existing role', async function () {69 await truffleAssert.reverts(70 roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO) // TEST_ROLE hasn't been added71 );72 });73 it('should revert zero address', async function () {74 await roles.addRole(TEST_ROLE);75 await truffleAssert.reverts(76 roles.addSubject(TEST_ROLE, zeroAddress, 1, TEST_NAME, TEST_DESC, TEST_LOGO)77 )78 });79 it('should revert add subject if such subject already exists', async function () {80 await roles.addRole(TEST_ROLE);81 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);82 const count = await roles.getRoleCount(TEST_ROLE);83 const id = await roles.getRoleAccToNum(TEST_ROLE, acc);84 const _acc = await roles.getRoleNumToAcc(TEST_ROLE, count);85 const subject = await roles.getRoleSubjects(TEST_ROLE, acc);86 assert.equal(count, 1);87 assert.equal(solToNum(id), solToNum(count));88 assert.equal(_acc, acc);89 assert.equal(subject.accessLevel, 1);90 assert.equal(subject.name, TEST_NAME);91 assert.equal(subject.description, TEST_DESC);92 assert.equal(subject.logo, TEST_LOGO);93 await truffleAssert.reverts(94 roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO)95 );96 });97 });98 describe('removeSubject', function () {99 it('should remove subject', async function () {100 await roles.addRole(TEST_ROLE);101 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);102 await roles.removeSubject(TEST_ROLE, acc);103 const count = await roles.getRoleCount(TEST_ROLE);104 assert.equal(count, 0);105 });106 it('should revert removing not existing subject', async function () {107 await roles.addRole(TEST_ROLE);108 await truffleAssert.reverts(109 roles.removeSubject(TEST_ROLE, accounts[3]) // random account110 );111 });112 it('should revert zero address', async function () {113 await roles.addRole(TEST_ROLE);114 await truffleAssert.reverts(115 roles.removeSubject(TEST_ROLE, zeroAddress) // random account116 );117 });118 });119 describe('updateAccessLevel', function () {120 it('should update access level', async function () {121 await roles.addRole(TEST_ROLE);122 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);123 let subj = await roles.getRoleSubjects(TEST_ROLE, acc);124 assert.equal(subj.accessLevel, 1);125 await roles.updateAccessLevel(TEST_ROLE, acc, 2);126 subj = await roles.getRoleSubjects(TEST_ROLE, acc);127 assert.equal(subj.accessLevel, 2);128 });129 it('should revert if not existing role', async function () {130 await roles.addRole(TEST_ROLE);131 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);132 await truffleAssert.reverts(133 roles.updateAccessLevel('ANOTHER_TEST_ROLE', acc, 2)134 )135 });136 it('should revert if not existing account', async function () {137 await roles.addRole(TEST_ROLE);138 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);139 await truffleAssert.reverts(140 roles.updateAccessLevel(TEST_ROLE, accounts[5], 2)141 );142 });143 it('should revert if user already have this status', async function () {144 await roles.addRole(TEST_ROLE);145 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);146 await truffleAssert.reverts(147 roles.updateAccessLevel(TEST_ROLE, acc, 1)148 );149 });150 it('should revert if zero address', async function () {151 await roles.addRole(TEST_ROLE);152 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);153 await truffleAssert.reverts(154 roles.updateAccessLevel(TEST_ROLE, zeroAddress, 1)155 );156 });157 });158 describe('setLogo', function () {159 it('should set logo', async function () {160 await roles.addRole(TEST_ROLE);161 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);162 await roles.setLogo(TEST_ROLE, acc, "ANOTHER_LOGO");163 let subj = await roles.getRoleSubjects(TEST_ROLE, acc);164 assert.equal(subj.logo, "ANOTHER_LOGO");165 });166 it('should revert if logo is empty string', async function () {167 await roles.addRole(TEST_ROLE);168 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);169 await truffleAssert.reverts(170 roles.setLogo(TEST_ROLE, acc, "")171 );172 });173 it('should revert zero address', async function () {174 await roles.addRole(TEST_ROLE);175 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);176 await truffleAssert.reverts(177 roles.setLogo(TEST_ROLE, zeroAddress, "ANOTHER_LOGO")178 );179 });180 it('should revert not existing role', async function () {181 await roles.addRole(TEST_ROLE);182 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);183 await truffleAssert.reverts(184 roles.setLogo('ANOTHER_TEST_ROLE', acc, "ANOTHER_LOGO")185 );186 });187 it('should revert not existing subject', async function () {188 await roles.addRole(TEST_ROLE);189 await truffleAssert.reverts(190 roles.setLogo(TEST_ROLE, acc, TEST_LOGO)191 );192 });193 });194 describe('setName', function () {195 it('should set name', async function () {196 await roles.addRole(TEST_ROLE);197 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);198 await roles.setName(TEST_ROLE, acc, "ANOTHER_NAME");199 let subj = await roles.getRoleSubjects(TEST_ROLE, acc);200 assert.equal(subj.name, "ANOTHER_NAME");201 });202 it('should revert if name is empty string', async function () {203 await roles.addRole(TEST_ROLE);204 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);205 await truffleAssert.reverts(206 roles.setName(TEST_ROLE, acc, "")207 );208 });209 it('should revert zero address', async function () {210 await roles.addRole(TEST_ROLE);211 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);212 await truffleAssert.reverts(213 roles.setName(TEST_ROLE, zeroAddress, "ANOTHER_NAME")214 );215 });216 it('should revert not existing role', async function () {217 await roles.addRole(TEST_ROLE);218 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);219 await truffleAssert.reverts(220 roles.setName('ANOTHER_TEST_ROLE', acc, "ANOTHER_NAME")221 );222 });223 it('should revert not existing subject', async function () {224 await roles.addRole(TEST_ROLE);225 await truffleAssert.reverts(226 roles.setName(TEST_ROLE, acc, TEST_NAME)227 );228 });229 });230 describe('setDescription', function () {231 it('should set description', async function () {232 await roles.addRole(TEST_ROLE);233 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);234 await roles.setDescription(TEST_ROLE, acc, "ANOTHER_DESC");235 let subj = await roles.getRoleSubjects(TEST_ROLE, acc);236 assert.equal(subj.description, "ANOTHER_DESC");237 });238 it('should revert if description is empty string', async function () {239 await roles.addRole(TEST_ROLE);240 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);241 await truffleAssert.reverts(242 roles.setDescription(TEST_ROLE, acc, "")243 );244 });245 it('should revert zero address', async function () {246 await roles.addRole(TEST_ROLE);247 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);248 await truffleAssert.reverts(249 roles.setDescription(TEST_ROLE, zeroAddress, "ANOTHER_DESC")250 );251 });252 it('should revert not existing role', async function () {253 await roles.addRole(TEST_ROLE);254 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);255 await truffleAssert.reverts(256 roles.setDescription('ANOTHER_TEST_ROLE', acc, "ANOTHER_DESC")257 );258 });259 it('should revert not existing subject', async function () {260 await roles.addRole(TEST_ROLE);261 await truffleAssert.reverts(262 roles.setDescription(TEST_ROLE, acc, TEST_DESC)263 );264 });265 });266 describe('haveRoleAndAccess', () => {267 it('should return true if have access', async () => {268 await roles.addRole(TEST_ROLE);269 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);270 const res = await roles.haveRoleAndAccess(TEST_ROLE, acc, 1);271 assert.equal(res, true);272 });273 it('should return false if required access level is not suitable', async () => {274 await roles.addRole(TEST_ROLE);275 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);276 const res = await roles.haveRoleAndAccess(TEST_ROLE, acc, 2);277 assert.equal(res, false);278 });279 it('should return false if no subject', async () => {280 await roles.addRole(TEST_ROLE);281 const res = await roles.haveRoleAndAccess(TEST_ROLE, acc, 1);282 assert.equal(res, false);283 });284 });285 describe('exist', () => {286 it('should revert exist with zero address', async () => {287 await truffleAssert.reverts(288 roles.exist(TEST_ROLE, zeroAddress)289 );290 });291 it('should return true if subject exist', async () => {292 await roles.addRole(TEST_ROLE);293 await roles.addSubject(TEST_ROLE, acc, 1, TEST_NAME, TEST_DESC, TEST_LOGO);294 const res = await roles.exist(TEST_ROLE, acc);295 expect(res, true);296 });297 it('should return false if subject does not exist', async () => {298 await roles.addRole(TEST_ROLE);299 const res = await roles.exist(TEST_ROLE, acc);300 expect(res, false);301 });302 });303 });...

Full Screen

Full Screen

test_result.js

Source:test_result.js Github

copy

Full Screen

1/**2 * Created by toozzapc2 on 27.12.2015.3 */4function resizePage() {5 6 var headerHeight = $('.page-header').outerHeight();7 var footerHeight = $('.page-footer').outerHeight();8 var titleHeight = $('.portlet-title').outerHeight(true);9 var nextHeight = $('.btn-next-wrapper').outerHeight(true);10 var height = App.getViewPort().height - headerHeight - footerHeight - titleHeight - nextHeight - 3*51;11 var heightResult = height / 9;12 if(heightResult < 40) {13 heightResult = 40;14 }15 $('.test-result').each(function() {16 var test_result = $(this);17 var test_desc = $(this).parent('.test-line').next('.collapse').find('.test-description');18 var widthResult = test_result.find(".name-cell").attr('aria-valuenow');;19 // test_result.find('.name-cell').css('height',heightResult + 'px');20 // test_result.find('.name-cell').css('lineHeight',heightResult + 'px');21 // if($(window).width() < 1025){22 // test_desc.css('width','100%');23 // }else{24 // test_desc.css('width',"calc("+widthResult + '% - 10px)');25 // }26 test_desc.css('width','100%');27 test_result.find(".name-table").css('width','100%');28 // test_result.find(".name-table").animate({29 // width: widthResult + '%',30 // }, 1000 );31 test_result.click(function() {32 var collapse = $('#collapse' + test_result.attr('id'));33 if(!collapse.hasClass('in')) {34 $('.name-cell .fa').removeClass('fa-angle-up').addClass('fa-angle-down');35 $(this).find('.fa').removeClass('fa-angle-down').addClass('fa-angle-up');36 collapse.collapse('toggle');37 $('.collapse').each(function () {38 if ($(this) != collapse) {39 $(this).collapse('hide');40 }41 });42 }43 });44 });45 46}47function loadPage() {48 resizePage();49 $('.test-result').each(function() {50 var test_result = $(this);51 var test_desc = $(this).parent('.test-line').next('.collapse').find('.test-description');52 var widthResult = test_result.find(".name-cell").attr('aria-valuenow');;53 54 // if($(window).width() < 1025){55 // test_desc.css('width','100%');56 // }else{57 // test_desc.css('width',"calc("+widthResult + '% - 10px)');58 // }59 test_desc.css('width','100%');60 test_result.find(".name-table").css('width','100%');61 // test_result.find(".name-table").animate({62 // width: widthResult + '%',63 // }, 1000 );64 });65 66}67$(document).ready(function(){68 $('.btn-next-wrapper .btn[data-toggle="popover"]').popover({69 placement: "right"70 });71});72$( document ).ready(loadPage);...

Full Screen

Full Screen

InventoryItem.test.js

Source:InventoryItem.test.js Github

copy

Full Screen

1import React from 'react';2import { shallow } from 'enzyme';3import InventoryItem from './InventoryItem';4describe('Testing the <InventoryItem /> component.', () => {5 const TEST_ID = 'test_id';6 const TEST_DESC = 'test_desc';7 const TEST_DATA = 'test_data.jpg';8 const TEST_NAME = 'test_name';9 const MOCK_SHOW_HANDLER = jest.fn();10 const MOCK_DELETE_HANDLER = jest.fn();11 let wrapper;12 beforeEach(() => {13 wrapper = shallow(<InventoryItem/>);14 });15 it('Renders the <InventoryItem /> component correctly when passed in the correct mocked properties.', () => {16 wrapper.setProps({ id: TEST_ID, name: TEST_NAME, description: TEST_DESC, data: TEST_DATA, show: MOCK_SHOW_HANDLER, delete: MOCK_DELETE_HANDLER });17 expect(wrapper.find('tr.InventoryItem').props()).toHaveProperty('id', TEST_ID);18 expect(wrapper.find('img.Image').props()).toHaveProperty('alt', TEST_DESC);19 expect(wrapper.find('img.Image').props()).toHaveProperty('src', `/images/${TEST_DATA}`);20 expect(wrapper.find('td.Name').text()).toEqual(TEST_NAME);21 expect(wrapper.find('td.Description').text()).toEqual(TEST_DESC);22 expect(wrapper.find('button.View').props()).toHaveProperty('onClick', MOCK_SHOW_HANDLER);23 expect(wrapper.find('button.Delete').props()).toHaveProperty('onClick', MOCK_DELETE_HANDLER);24 });25 ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2wpt.test_desc('test_desc method of wpt module');3var wpt = require('wpt');4wpt.test_desc('test_desc method of wpt module');5var wpt = require('wpt');6wpt.test_desc('test_desc method of wpt module');7var wpt = require('wpt');8wpt.test_desc('test_desc method of wpt module');9var wpt = require('wpt');10wpt.test_desc('test_desc method of wpt module');11var wpt = require('wpt');12wpt.test_desc('test_desc method of wpt module');13var wpt = require('wpt');14wpt.test_desc('test_desc method of wpt module');15var wpt = require('wpt');16wpt.test_desc('test_desc method of wpt module');17var wpt = require('wpt');18wpt.test_desc('test_desc method of wpt module');19var wpt = require('wpt');20wpt.test_desc('test_desc method of wpt module');21var wpt = require('wpt');22wpt.test_desc('test_desc method of wpt module');23var wpt = require('wpt');24wpt.test_desc('test_desc method of wpt module');25var wpt = require('wpt');26wpt.test_desc('test_desc method

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt');2wpt.test_desc('test description');3wpt.test_desc('test description1');4wpt.test_desc('test description2');5wpt.test_desc('test description3');6wpt.test_desc('test description4');7wpt.test_desc('test description5');8wpt.test_desc('test description6');9wpt.test_desc('test description7');10wpt.test_desc('test description8');11wpt.test_desc('test description9');12wpt.test_desc('test description10');13wpt.test_desc('test description11');14wpt.test_desc('test description12');15wpt.test_desc('test description13');16wpt.test_desc('test description14');17wpt.test_desc('test description15');18wpt.test_desc('test description16');19wpt.test_desc('test description17');20wpt.test_desc('test description18');21wpt.test_desc('test description19');22wpt.test_desc('test description20');23wpt.test_desc('test description21');24wpt.test_desc('test description22');25wpt.test_desc('test description23');26wpt.test_desc('test description24');27wpt.test_desc('test description25');28wpt.test_desc('test description26');29wpt.test_desc('test description27');30wpt.test_desc('test description28');31wpt.test_desc('test description29');32wpt.test_desc('test description30');33wpt.test_desc('test description31');34wpt.test_desc('test description32');35wpt.test_desc('test description33');36wpt.test_desc('test description34');37wpt.test_desc('test description35');38wpt.test_desc('test description36');39wpt.test_desc('test description37');40wpt.test_desc('test description38');41wpt.test_desc('test description39');42wpt.test_desc('test description40');43wpt.test_desc('test description41');44wpt.test_desc('test description42');45wpt.test_desc('test description43');46wpt.test_desc('test description44');47wpt.test_desc('test description45');48wpt.test_desc('test description46');49wpt.test_desc('test description47');50wpt.test_desc('test description48');51wpt.test_desc('test description49');52wpt.test_desc('test description50');53wpt.test_desc('test description51');54wpt.test_desc('test description52');55wpt.test_desc('test description53');

Full Screen

Using AI Code Generation

copy

Full Screen

1wpt.test_desc("This is a test script");2wpt.test_desc("This is a second test script");3wpt.test_desc("This is a test script");4wpt.test_desc("This is a second test script");5wpt.test_desc("This is a test script");6wpt.test_desc("This is a second test script");7wpt.test_desc("This is a test script");8wpt.test_desc("This is a second test script");9wpt.test_desc("This is a test script");10wpt.test_desc("This is a second test script");11wpt.test_desc("This is a test script");12wpt.test_desc("This is a second test script");13wpt.test_desc("This is a test script");14wpt.test_desc("This is a second test script");15wpt.test_desc("This is a test script");16wpt.test_desc("This is a second test script");17wpt.test_desc("This is a test script");18wpt.test_desc("This is a second test script");19wpt.test_desc("This is a test script");20wpt.test_desc("This is a second test script");21wpt.test_desc("This is a test script");22wpt.test_desc("This is a second test script");23wpt.test_desc("This is a test script");24wpt.test_desc("This is a second test script");

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2wpt.test_desc('test_desc');3exports.test_desc = function(desc) {4 console.log(desc);5};6(function (exports, require, module, __filename, __dirname) {7});8var wpt = require('./wpt.js');9wpt.test_desc('test_desc');10(function (exports, require, module, __filename, __dirname) {11 exports.test_desc = function(desc) {12 console.log(desc);13 };14});

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful