How to use actAndAssert method in stryker-parent

Best JavaScript code snippet using stryker-parent

appInit.spec.ts

Source:appInit.spec.ts Github

copy

Full Screen

...422423 describe("auth errors", () => {424 it ("sets auth error if getCurrentEngineer throws", async done => {425 engineerServiceStub.getCurrentEngineer = sandbox.stub().rejects(exception);426 await actAndAssert(true, done);427 });428429 it ("sets auth error if analytics service throws", async done => {430 analyticsServiceStub.initialize = sandbox.stub().rejects(exception);431 await actAndAssert(true, done);432 });433434 it ("sets auth error if authenticate throws", async done => {435 authenticationServiceStub.authenticate = sandbox.stub().rejects(exception);436 await actAndAssert(true, done);437 });438439 it ("sets auth error if engineer initialise throws", async done => {440 engineerServiceStub.initialise = sandbox.stub().rejects(exception);441 await actAndAssert(true, done);442 });443444 it ("sets auth error if override engineer throws", async done => {445 engineerServiceStub.overrideEngineerId = sandbox.stub().rejects(exception);446 await actAndAssert(true, done);447 });448 });449450 describe("non auth errors", ()=> {451 it ("does not set auth error if initialiseApplicationSettings throws", async done => {452 storageServiceStub.getAppSettings = sandbox.stub().rejects(exception);453 await actAndAssert(false, done);454 });455456 it ("does not set auth error if set static headers throws", async done => {457 fftHeaderProviderStub.setStaticHeaders = sandbox.stub().throws(exception);458 await actAndAssert(false, done);459 });460461 it ("does not set auth error if referenceDataServices throws", async done => {462 referenceDataSerivce.initialise = sandbox.stub().rejects(exception);463 await actAndAssert(false, done);464 });465466 it ("does not set auth error if loadConsumables throws", async done => {467 catalogServiceStub.loadConsumables = sandbox.stub().rejects(exception);468 await actAndAssert(false, done);469 });470471 it ("does not set auth error if adaptBusinessService throws", async done => {472 adaptBusinessServiceStub.initialise = sandbox.stub().rejects(exception);473 await actAndAssert(false, done);474 });475476 it ("does not set auth error if workRetrievalService throws", async done => {477 workRetrievalServiceStub.initialise = sandbox.stub().rejects(exception);478 await actAndAssert(false, done);479 });480481 it ("does not set auth error if archiveService throws", async done => {482 archiveServiceStub.initialise = sandbox.stub().rejects(exception);483 await actAndAssert(false, done);484 });485486 it ("does not set auth error if messageServiceStub throws", async done => {487 messageServiceStub.initialise = sandbox.stub().rejects(exception);488 await actAndAssert(false, done);489 });490 });491492 });493494 describe("authorisation sequence", () => {495 it("calls authentication service when user is not already signed on", async done => {496 engineerServiceStub.getCurrentEngineer = sandbox.stub().resolves(<Engineer>{isSignedOn: false});497 await appInit.attachedAsync();498499 expect((authenticationServiceStub.authenticate as Sinon.SinonStub).args[0][1]).toBe(false);500 done();501 });502 ...

Full Screen

Full Screen

ChangesTest.ts

Source:ChangesTest.ts Github

copy

Full Screen

...26 observable.on("error", err => {27 reject(err);28 });29 });30 await Promise.race([ errPromise, actAndAssert() ]);31 async function actAndAssert() {32 try {33 observable.on("data", handler);34 {35 const session = store.openSession();36 const user = new User();37 await session.store(user, "users/1");38 await session.saveChanges();39 }40 const documentChange = await changesList.poll(2000);41 assert.ok(documentChange);42 assert.strictEqual(documentChange.id, "users/1");43 assert.strictEqual(documentChange.collectionName, "Users");44 assert.strictEqual(documentChange.type, "Put");45 try {46 await changesList.poll(100);47 assert.fail("Should have thrown");48 } catch (err) {49 assert.strictEqual(err.name, "TimeoutException");50 }51 } finally {52 observable.off("data", handler);53 }54 // at this point we should be unsubscribed from changes on 'users/1'55 {56 const session = store.openSession();57 const user = new User();58 user.name = "another name";59 await session.store(user, "users/1");60 await session.saveChanges();61 }62 // it should be empty as we destroyed subscription63 try {64 await changesList.poll(100);65 assert.fail("Should have thrown");66 } catch (err) {67 assert.strictEqual(err.name, "TimeoutException");68 }69 }70 });71 it("can obtain all documents changes", async () => {72 const changesList = new AsyncQueue<DocumentChange>();73 const changes = store.changes();74 await changes.ensureConnectedNow();75 const observable = changes.forAllDocuments();76 await observable.ensureSubscribedNow();77 const handler = (change: DocumentChange) => changesList.push(change);78 const errPromise = new Promise((_, reject) => {79 observable.on("error", err => {80 reject(err);81 });82 });83 await Promise.race([errPromise, actAndAssert()]);84 async function actAndAssert() {85 try {86 observable.on("data", handler);87 observable.on("error", e => throwError("InvalidOperationException", e.message));88 {89 const session = store.openSession();90 const user = new User();91 await session.store(user, "users/1");92 await session.saveChanges();93 }94 const documentChange = await changesList.poll(1000);95 assert.ok(documentChange);96 assert.strictEqual(documentChange.id, "users/1");97 assert.strictEqual(documentChange.type, "Put");98 try {99 await changesList.poll(100);100 assert.fail("Should have thrown");101 } catch (err) {102 assert.strictEqual(err.name, "TimeoutException");103 }104 } finally {105 observable.off("data", handler);106 }107 // at this point we should be unsubscribed from changes on 'users/1'108 {109 const session = store.openSession();110 const user = new User();111 user.name = "another name";112 await session.store(user, "users/1");113 await session.saveChanges();114 }115 // it should be empty as we destroyed subscription116 try {117 await changesList.poll(100);118 assert.fail("Should have thrown");119 } catch (err) {120 assert.strictEqual(err.name, "TimeoutException");121 }122 }123 });124 class UsersByName extends AbstractJavaScriptIndexCreationTask<User, { name: string, count: number }> {125 constructor() {126 super();127 this.map(User, c => {128 return {129 name: c.name,130 count: 1131 }132 });133 this.reduce(result => result.groupBy(x => x.name).aggregate(g => {134 return {135 name: g.key,136 count: g.values.reduce((a, b) => a + b.count, 0)137 }138 }));139 }140 }141 it("can obtain single index changes", async () => {142 const changesList = new AsyncQueue<IndexChange>();143 await store.executeIndex(new UsersByName());144 const changes = store.changes();145 await changes.ensureConnectedNow();146 const observable = changes.forIndex(new UsersByName().getIndexName());147 await observable.ensureSubscribedNow();148 const handler = (change: IndexChange) => changesList.push(change);149 const errPromise = new Promise((_, reject) => {150 observable.on("error", err => {151 reject(err);152 });153 });154 await Promise.race([errPromise, actAndAssert()]);155 async function actAndAssert() {156 try {157 observable.on("data", handler);158 const operation = new SetIndexesPriorityOperation(new UsersByName().getIndexName(), "Low");159 await store.maintenance.send(operation);160 const indexChange = await changesList.poll(2000);161 assert.ok(indexChange);162 assert.strictEqual(indexChange.name, new UsersByName().getIndexName());163 } finally {164 observable.off("data", handler);165 }166 }167 });168 it("can obtain all index changes", async () => {169 const changesList = new AsyncQueue<IndexChange>();170 await store.executeIndex(new UsersByName());171 const changes = store.changes();172 await changes.ensureConnectedNow();173 const observable = changes.forAllIndexes();174 await observable.ensureSubscribedNow();175 const handler = (change: IndexChange) => changesList.push(change);176 const errPromise = new Promise((_, reject) => {177 observable.on("error", err => {178 reject(err);179 });180 });181 await Promise.race([errPromise, actAndAssert()]);182 async function actAndAssert() {183 try {184 observable.on("data", handler);185 const operation = new SetIndexesPriorityOperation(new UsersByName().getIndexName(), "Low");186 await store.maintenance.send(operation);187 const indexChange = await changesList.poll(2000);188 assert.ok(indexChange);189 assert.strictEqual(indexChange.name, new UsersByName().getIndexName());190 } finally {191 observable.off("data", handler);192 }193 }194 });195 it("can obtain notification about documents starting with", async () => {196 const changesList = new AsyncQueue<DocumentChange>();197 const changes = store.changes();198 await changes.ensureConnectedNow();199 const observable = changes.forDocumentsStartingWith("users/");200 await observable.ensureSubscribedNow();201 const handler = (change: DocumentChange) => changesList.push(change);202 const errPromise = new Promise((_, reject) => {203 observable.on("error", err => {204 reject(err);205 });206 });207 await Promise.race([errPromise, actAndAssert()]);208 async function actAndAssert() {209 try {210 observable.on("data", handler);211 {212 const session = store.openSession();213 const user = new User();214 await session.store(user, "users/1");215 await session.saveChanges();216 }217 {218 const session = store.openSession();219 const user = new User();220 await session.store(user, "differentDocumentPrefix/1");221 await session.saveChanges();222 }223 {224 const session = store.openSession();225 const user = new User();226 await session.store(user, "users/2");227 await session.saveChanges();228 }229 let documentChange = await changesList.poll(2000);230 assert.ok(documentChange);231 assert.strictEqual(documentChange.id, "users/1");232 documentChange = await changesList.poll(2000);233 assert.ok(documentChange);234 assert.strictEqual(documentChange.id, "users/2");235 } finally {236 observable.off("data", handler);237 }238 }239 });240 it("can obtain notification about documents starting with", async () => {241 const changesList = new AsyncQueue<DocumentChange>();242 const changes = store.changes();243 await changes.ensureConnectedNow();244 const observable = changes.forDocumentsInCollection("users");245 await observable.ensureSubscribedNow();246 const handler = (change: DocumentChange) => changesList.push(change);247 const errPromise = new Promise((_, reject) => {248 observable.on("error", err => {249 reject(err);250 });251 });252 await Promise.race([errPromise, actAndAssert()]);253 async function actAndAssert() {254 try {255 observable.on("data", handler);256 {257 const session = store.openSession();258 const user = new User();259 await session.store(user, "users/1");260 await session.saveChanges();261 }262 {263 const session = store.openSession();264 const order = new Order();265 await session.store(order, "orders/1");266 await session.saveChanges();267 }...

Full Screen

Full Screen

json-casing.spec.ts

Source:json-casing.spec.ts Github

copy

Full Screen

...95 {96 //Arrange97 var camelObj = { prop1: "prop 1", prop2: "prop 2" };98 var pascalObj = { Prop1: "prop 1", Prop2: "prop 2" };99 actAndAssert(camelObj, pascalObj);100 });101 it("should support a deep conversion with a date", () =>102 {103 //Arrange104 var date = new Date();105 var camelObj = { prop1: "prop 1", obj1: { deepProp1: "dp1", deepProp2: "dp2", date } };106 var pascalObj = { Prop1: "prop 1", Obj1: { DeepProp1: "dp1", DeepProp2: "dp2", Date: date } };107 actAndAssert(camelObj, pascalObj);108 });109 function actAndAssert(camelObj, pascalObj)110 {111 //Act112 var result = JSONCasing.toPascal(camelObj);113 //Assert114 expect(JSON.stringify(result)).toEqual(JSON.stringify(pascalObj));115 }116 });117 describe("To Camel", () =>118 {119 it("should support a shallow conversion", () =>120 {121 //Arrange122 var camelObj = { prop1: "prop 1", prop2: "prop 2" };123 var pascalObj = { Prop1: "prop 1", Prop2: "prop 2" };124 actAndAssert(camelObj, pascalObj);125 });126 it("should support a deep conversion with a date", () =>127 {128 //Arrange129 var date = new Date();130 var camelObj = { prop1: "prop 1", obj1: { deepProp1: "dp1", deepProp2: "dp2", date } };131 var pascalObj = { Prop1: "prop 1", Obj1: { DeepProp1: "dp1", DeepProp2: "dp2", Date: date } };132 actAndAssert(camelObj, pascalObj);133 });134 function actAndAssert(camelObj, pascalObj)135 {136 //Act137 var result = JSONCasing.toCamel(pascalObj);138 //Assert139 expect(JSON.stringify(result)).toEqual(JSON.stringify(camelObj));140 }141 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1module.exports = function (config) {2 config.set({3 mochaOptions: {4 },5 });6};7module.exports = function (config) {8 config.set({9 mochaOptions: {10 },11 });12};13module.exports = function (config) {14 config.set({15 mochaOptions: {16 },17 });18};19module.exports = function (config) {20 config.set({

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2var assert = require('assert');3strykerParent.actAndAssert({4 act: function () {5 var x = 1;6 return x;7 },8 assert: function (result) {9 assert.equal(result, 1);10 }11});12var strykerParent = require('stryker-parent');13var assert = require('assert');14strykerParent.actAndAssert({15 act: function () {16 var x = 1;17 return x;18 },19 assert: function (result) {20 assert.equal(result, 1);21 }22});23var strykerParent = require('stryker-parent');24var assert = require('assert');25strykerParent.actAndAssert({26 act: function () {27 var x = 1;28 return x;29 },30 assert: function (result) {31 assert.equal(result, 1);32 }33});34var strykerParent = require('stryker-parent');35var assert = require('assert');36strykerParent.actAndAssert({37 act: function () {38 var x = 1;39 return x;40 },41 assert: function (result) {42 assert.equal(result, 1);43 }44});45var strykerParent = require('stryker-parent');46var assert = require('assert');47strykerParent.actAndAssert({48 act: function () {49 var x = 1;50 return x;51 },52 assert: function (result) {53 assert.equal(result, 1);54 }55});56var strykerParent = require('stryker-parent');57var assert = require('assert');58strykerParent.actAndAssert({59 act: function () {60 var x = 1;61 return x;62 },63 assert: function (result) {64 assert.equal(result, 1);65 }66});

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2var options = {3};4var runner = new stryker.Runner(options);5runner.runMutationTest().then(function (result) {6 console.log(result);7});

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2var assert = require('assert');3var actAndAssert = strykerParent.actAndAssert;4var path = require('path');5var myPath = path.resolve(__dirname, 'test.js');6actAndAssert(myPath, function (sandbox) {7 assert.equal(1 + 1, 2);8});9var strykerParent = require('stryker-parent');10var assert = require('assert');11var actAndAssert = strykerParent.actAndAssert;12var path = require('path');13var myPath = path.resolve(__dirname, 'test.js');14actAndAssert(myPath, function (sandbox) {15 assert.equal(1 + 1, 2);16});17var strykerParent = require('stryker-parent');18var assert = require('assert');19var actAndAssert = strykerParent.actAndAssert;20var path = require('path');21var myPath = path.resolve(__dirname, 'test.js');22actAndAssert(myPath, function (sandbox) {23 assert.equal(1 + 1, 2);24});25var strykerParent = require('stryker-parent');26var assert = require('assert');27var actAndAssert = strykerParent.actAndAssert;28var path = require('path');29var myPath = path.resolve(__dirname, 'test.js');30actAndAssert(myPath, function (sandbox) {31 assert.equal(1 + 1, 2);32});33var strykerParent = require('stryker-parent');34var assert = require('assert');35var actAndAssert = strykerParent.actAndAssert;36var path = require('path');37var myPath = path.resolve(__dirname, 'test.js');38actAndAssert(myPath, function (sandbox) {39 assert.equal(1 + 1, 2);40});41var strykerParent = require('stryker-parent');42var assert = require('assert');

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 stryker-parent 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