This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any, ClassVar | |
import Boost.Python | |
class Camera(Boost.Python.instance): | |
@classmethod | |
def __init__(cls, *args, **kwargs) -> None: ... | |
@classmethod | |
def Rotate(cls, *args, **kwargs) -> Any: ... | |
@classmethod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default (mongoClient, db) => { | |
return { | |
async checkoutTransaction(closure) { | |
const session = mongoClient.startSession({ | |
causalConsistency: true | |
}); | |
try { | |
const sessionRepository = { | |
async findInventoryByProuctSkus(productSkus) { | |
return db.collection('inventory').find({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {jest} from '@jest/globals'; | |
import Service, {InsufficientStock} from './service'; | |
describe('checkout', () => { | |
test('fails when insufficient stock for desired product', async () => { | |
const session = { | |
findInventoryByProuctSkus: jest.fn() | |
.mockResolvedValueOnce([ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {jest} from '@jest/globals'; | |
import Service, {InsufficientStock} from './service'; | |
describe('checkout', () => { | |
test('fails when insufficient stock for desired product', async () => { | |
const repository = { | |
findInventoryByProductSku: jest.fn() | |
.mockResolvedValueOnce({ | |
productSku: 'some product sku', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash'; | |
export class InsufficientStock extends Error { | |
constructor(message) { | |
super(message); | |
this.name = 'InsufficientStock'; | |
} | |
} | |
export default (repository) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash'; | |
export class InsufficientStock extends Error { | |
constructor(message) { | |
super(message); | |
this.name = 'InsufficientStock'; | |
} | |
} | |
export default (repository) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async checkInTeam(teamID) { | |
return db.collection('teams').updateOne({ | |
_id: teamID | |
}, { | |
$set: { | |
checkedInAt: new Date() | |
} | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {jest} from '@jest/globals' | |
import Service from './service'; | |
test('teams with disqualified players cannot check-in', async () => { | |
const repository = { | |
findDisqualifiedPlayers: jest.fn() | |
.mockResolvedValueOnce([ | |
{ | |
teamID: 'some team id', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {jest} from '@jest/globals' | |
import Service from './service'; | |
test('teams with disqualified players cannot check-in', async () => { | |
const playerDisqualificationsFindToArray = jest.fn() | |
.mockResolvedValueOnce([ | |
{ | |
teamID: 'some team id', | |
reason: 'was a big meanie' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Service from './service'; | |
test('teams with disqualified players cannot check-in', async () => { | |
const db = { | |
collection(collection) { | |
switch (collection) { | |
case 'playerDisqualifications': { | |
return { | |
find({teamID}) { | |
expect(teamID).toBe('some team id'); |
NewerOlder