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
function CommunicationList() { | |
const [communications, setCommunications] = useState<Communication[] | null>( | |
null | |
); | |
useEffect(() => { | |
fetch("/communications") | |
.then((res) => res.json()) | |
.then(setCommunications); | |
}, []); |
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
expect(CommunicationQueue).to receive(:enqueue).with(hash_including(text: 'Some Message2'))) |
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
describe 'The SendCommunicationService' do | |
it 'Queues an email send with the correct text' do | |
# arrange the messaging layer with a mock implementation to ensure | |
# messages are sent with the correct text at *any* point during the test | |
expect(CommunicationQueue).to receive(:enqueue) do |message_payload| | |
# assert | |
expect(message_payload[:text].to).eq('Some Message') | |
end | |
UserCommunication.create!(user_id: 3, text: 'Some Message', type: 'email') |
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
select | |
customer_to_chase.name, | |
customer_to_chase.telephone_number, | |
upcoming_reservation.start, | |
upcoming_reservation.finish, | |
upcoming_reservation.cost | |
from | |
reservation_request upcoming_reservation | |
left outer join confirmed_booking confirmed_booking | |
on confirmed_booking.reservation_request_id = upcoming_reservation.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
select | |
c.name, | |
c.telephone_number, | |
rr.start, | |
rr.finish, | |
rr.cost | |
from | |
reservation_request rr | |
left outer join confirmed_booking cb on cb.reservation_request_id = rr.id | |
inner join customer c on c.id = rr.customer_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
function isPrime(numberToCheck: number) { | |
if (numberToCheck <= 1) return false; | |
for (let possibleDivisor = 2; possibleDivisor <= numberToCheck; possibleDivisor++) { | |
if (numberToCheck % possibleDivisor === 0) return false; | |
} | |
return true; | |
} | |
const numbers = [99999, 12, 15]; | |
const allFactors = []; |
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
function isPrime(num: number) { | |
if (num <= 1) return false; | |
for (let i = 2; i <= num; i++) { | |
if (num % i === 0) return false; | |
} | |
return true; | |
} | |
const numbers = [99999, 12, 15]; | |
const allFactors = []; |
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
#### | |
# Backup the conents of f_a to f_b | |
# then compress f_a by removing all duplicates | |
#### | |
def backup_then_remove_duplicates( | |
f_a, | |
f_b | |
) | |
f_a = File.open(f_a, File::RDWR) |
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
require "set" | |
#### | |
# Backup the conents of the remove_duplicates_file to the backup_destination_file | |
# Then remove all duplicated lines from the remove_duplicates_file | |
#### | |
def backup_then_remove_duplicates( | |
backup_destination_file_path, | |
remove_duplicates_file_path | |
) |
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
[Test] | |
public void FullNameConcatenatesFirstAndLastName() | |
{ | |
// Arrange | |
Person personUnderTest = new() | |
{ | |
FirstName = "SomeFirstName", | |
LastName = "SomeSecondName", | |
Email = "[email protected]" | |
}; |