Repository: TheOdinProject/odin-bot-v2
Pull request #96 (2021-01-23 00:22:30)

add bootcamp command
- adds a bootcamp command with a "fun" message
<img width="907" alt="Screen Shot 2021-01-22 at 4 21 50 PM" src="https://user-images.githubusercontent.com/22967723/105562169-01507300-5cce-11eb-9405-4401bbe1ce4d.png">



Patch:
diff --git a/botCommands/bootcamps.js b/botCommands/bootcamps.js
new file mode 100644
index 0000000..2bb4f3b
--- /dev/null
+++ b/botCommands/bootcamps.js
@@ -0,0 +1,10 @@
+const { registerBotCommand } = require('../botEngine.js');
+
+const command = {
+  regex: /(?<!\S)\/bootcamps(?!\S)/,
+  cb: () => 'Friends don\'t let friends commit to bootcamps without being informed.  https://twitter.com/lzsthw/status/1212284566431576069',
+};
+
+registerBotCommand(command.regex, command.cb);
+
+module.exports = command;
diff --git a/botCommands/windows.js b/botCommands/windows.js
deleted file mode 100644
index 4dd6248..0000000
--- a/botCommands/windows.js
+++ /dev/null
@@ -1,12 +0,0 @@
-const { registerBotCommand } = require("../botEngine.js");
-
-const command = {
-  regex: /(?<!\S)\/windows(?!\S)/,
-  cb: () => { 
-    return `The Odin Project does not support Windows, WSL, or any OS outside of our recommendations. We are happy to assist with any questions about installing a VM or dual booting Linux. https://www.theodinproject.com/courses/foundations/lessons/installation-overview#os-options `
-  },
-};
-
-registerBotCommand(command.regex, command.cb);
-
-module.exports = command;


Test patch:
diff --git a/botCommands/__snapshots__/bootcamps.test.js.snap b/botCommands/__snapshots__/bootcamps.test.js.snap
new file mode 100644
index 0000000..be78332
--- /dev/null
+++ b/botCommands/__snapshots__/bootcamps.test.js.snap
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`/bootcamps callback returns correct output 1`] = `"Friends don't let friends commit to bootcamps without being informed.  https://twitter.com/lzsthw/status/1212284566431576069"`;
diff --git a/botCommands/__snapshots__/windows.test.js.snap b/botCommands/__snapshots__/windows.test.js.snap
deleted file mode 100644
index 3dc17cb..0000000
--- a/botCommands/__snapshots__/windows.test.js.snap
+++ /dev/null
@@ -1,3 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`/windows callback returns correct output 1`] = `"The Odin Project does not support Windows, WSL, or any OS outside of our recommendations. We are happy to assist with any questions about installing a VM or dual booting Linux. https://www.theodinproject.com/courses/foundations/lessons/installation-overview#os-options "`;
diff --git a/botCommands/bootcamps.test.js b/botCommands/bootcamps.test.js
new file mode 100644
index 0000000..de73feb
--- /dev/null
+++ b/botCommands/bootcamps.test.js
@@ -0,0 +1,52 @@
+const command = require('./bootcamps');
+
+describe('/bootcamps', () => {
+  describe('regex', () => {
+    it.each([
+      ['/bootcamps'],
+      [' /bootcamps'],
+      ['/bootcamps @odin-bot'],
+      ['@odin-bot /bootcamps'],
+    ])('correct strings trigger the callback', (string) => {
+      expect(command.regex.test(string)).toBeTruthy();
+    });
+
+    it.each([
+      ['botcamps'],
+      ['bootcamps'],
+      ['bootcamp'],
+      ['/bootcamp'],
+      ['/bootcmp'],
+      ['/ bootcamps'],
+      ['/abootcamps'],
+    ])("'%s' does not trigger the callback", (string) => {
+      expect(command.regex.test(string)).toBeFalsy();
+    });
+
+    it.each([
+      ['Check this out! /bootcamps'],
+      ['Don\'t worry about /bootcamps'],
+      ['Hey @odin-bot, /bootcamps'],
+      ['/@odin-bot ^ /me /bootcamps /tests$*'],
+    ])("'%s' - command can be anywhere in the string", (string) => {
+      expect(command.regex.test(string)).toBeTruthy();
+    });
+
+    it.each([
+      ['@user/bootcamps'],
+      ['it\'s about/bootcamps'],
+      ['/bootcampsanillusion'],
+      ['/bootcamps/'],
+      ['/bootcamps*'],
+      ['/bootcamps...'],
+    ])("'%s' - command should be its own word/group - no leading or trailing characters", (string) => {
+      expect(command.regex.test(string)).toBeFalsy();
+    });
+  });
+
+  describe('callback', () => {
+    it('returns correct output', () => {
+      expect(command.cb()).toMatchSnapshot();
+    });
+  });
+});
diff --git a/botCommands/windows.test.js b/botCommands/windows.test.js
deleted file mode 100644
index 14ab870..0000000
--- a/botCommands/windows.test.js
+++ /dev/null
@@ -1,52 +0,0 @@
-const command = require('./windows')
-
-describe('/windows', () => {
-  describe('regex', () => {
-    it.each([
-      ['/windows'],
-      [' /windows'],
-      ['/windows @odin-bot'],
-      ['@odin-bot /windows'],
-    ])('correct strings trigger the callback', (string) => {
-      expect(command.regex.test(string)).toBeTruthy()
-    })
-    
-    it.each([
-     ["wndows"],
-     ["windows"],
-     ["window"],
-     ["/wndows"],
-     ["/window"],
-     ["/ windows"],
-     ["/awindows"]
-    ])("'%s' does not trigger the callback", (string) => {
-      expect(command.regex.test(string)).toBeFalsy()
-    })
-
-    it.each([
-      ['Check this out! /windows'],
-      ['Don\'t worry about /windows'],
-      ['Hey @odin-bot, /windows'],
-      ['/@odin-bot ^ /me /windows /tests$*']
-    ])("'%s' - command can be anywhere in the string", (string) => {
-      expect(command.regex.test(string)).toBeTruthy()
-    })
-
-    it.each([
-      ['@user/windows'],
-      ['it\'s about/windows'],
-      ['/windowsanillusion'],
-      ['/windows/'],
-      ['/windows*'],
-      ['/windows...']
-    ])("'%s' - command should be its own word/group - no leading or trailing characters", (string) => {
-      expect(command.regex.test(string)).toBeFalsy()
-    })
-  })
-
-  describe('callback', () => {
-    it('returns correct output', () => {
-      expect(command.cb()).toMatchSnapshot()
-    })
-  })
-})